notifications: disableable popups, configurable max popup count

This commit is contained in:
Damocles 2026-04-13 15:35:12 +02:00
parent ce62d8f9cd
commit 9358f8fe6e
5 changed files with 28 additions and 4 deletions

View file

@ -21,7 +21,9 @@ QtObject {
})
property var notifications: ({
enable: true,
timeout: 3000
timeout: 3000,
popups: true,
maxPopups: 4
})
property var mpris: ({
enable: true

View file

@ -34,7 +34,7 @@ PanelWindow {
property var _knownIds: ({})
Repeater {
model: M.NotifService.popups.slice(0, 4)
model: M.NotifService.popups.slice(0, M.Modules.notifications.maxPopups || 4)
delegate: Item {
id: popupItem

View file

@ -83,6 +83,15 @@ QtObject {
root.list = [data, ...root.list];
// Dismiss excess popups (keep in history, just hide popup)
const max = M.Modules.notifications.maxPopups || 4;
const currentPopups = root.list.filter(n => n.popup && !n.closed);
if (currentPopups.length > max) {
for (let i = max; i < currentPopups.length; i++)
currentPopups[i].popup = false;
root._changed();
}
// Auto-expire popup
if (data.popup) {
const timeout = notif.expireTimeout > 0 ? notif.expireTimeout : (M.Modules.notifications.timeout || 3000);

View file

@ -98,6 +98,16 @@ in
default = 3000;
description = "Notification popup timeout in milliseconds.";
};
popups = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Show notification popups.";
};
maxPopups = lib.mkOption {
type = lib.types.int;
default = 4;
description = "Maximum number of notification popups shown simultaneously.";
};
};
bluetooth = moduleOpt "bluetooth" (intervalOpt 5000);
network = moduleOpt "network" (intervalOpt 5000);

View file

@ -19,8 +19,11 @@ ShellRoot {
screen: scope.modelData
}
NotifPopup {
screen: scope.modelData
LazyLoader {
active: Modules.notifications.popups
NotifPopup {
screen: scope.modelData
}
}
LazyLoader {