notifications: disableable popups, configurable max popup count
This commit is contained in:
parent
ce62d8f9cd
commit
9358f8fe6e
5 changed files with 28 additions and 4 deletions
|
|
@ -21,7 +21,9 @@ QtObject {
|
|||
})
|
||||
property var notifications: ({
|
||||
enable: true,
|
||||
timeout: 3000
|
||||
timeout: 3000,
|
||||
popups: true,
|
||||
maxPopups: 4
|
||||
})
|
||||
property var mpris: ({
|
||||
enable: true
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,12 @@ ShellRoot {
|
|||
screen: scope.modelData
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
active: Modules.notifications.popups
|
||||
NotifPopup {
|
||||
screen: scope.modelData
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
active: Modules.backgroundOverlay.enable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue