feat(quickshell): group the notification log by sender
The log lists one entry per app, ordered by each app's newest notification. An app with several shows a header with its name, a count and a clear mark for that app alone, then its newest entry and a '+ N more' line; clicking either unfolds the rest. Entries under a header drop their own sender line and keep the urgency dot.
This commit is contained in:
1 parent
ec76f8dec3
commit
32d5683fad
4 files changed
+211
-7
No files matched your search
@@ -17,6 +17,19 @@ Singleton {
|
||||
property int maxHistory: 60
|
||||
|
||||
readonly property int count: history.length
|
||||
|
||||
// The history by sender, for the log: one entry per app, newest first
|
||||
// inside each, the apps ordered by their newest notification.
|
||||
readonly property var groups: {
|
||||
const byApp = {};
|
||||
const order = [];
|
||||
for (const n of root.history) {
|
||||
const app = n.appName || "System";
|
||||
if (!(app in byApp)) { byApp[app] = []; order.push(app); }
|
||||
byApp[app].push(n);
|
||||
}
|
||||
return order.map(app => ({ app: app, items: byApp[app] }));
|
||||
}
|
||||
readonly property bool hasUnread: unread > 0
|
||||
property int unread: 0
|
||||
|
||||
@@ -57,6 +70,12 @@ Singleton {
|
||||
notif.dismiss();
|
||||
}
|
||||
|
||||
function dismissApp(app: string) {
|
||||
const gone = root.history.filter(n => (n.appName || "System") === app);
|
||||
root.history = root.history.filter(n => (n.appName || "System") !== app);
|
||||
for (const n of gone) n.dismiss();
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
const all = root.history.slice();
|
||||
root.history = [];
|
||||
|
||||
Reference in new issue
Block a user