notifications: centralize icon resolution in NotifItem.resolvedIcon, fix lock pill grouping and missing fallbacks
This commit is contained in:
parent
99b63a2756
commit
d4001f7900
4 changed files with 23 additions and 32 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import "../services" as S
|
||||
|
||||
Row {
|
||||
|
|
@ -12,13 +11,15 @@ Row {
|
|||
const notifs = S.NotifService.list.filter(n => n.state !== "dismissed");
|
||||
const groups = {};
|
||||
for (const n of notifs) {
|
||||
const key = n.appIcon || n.appName || "unknown";
|
||||
const key = n.appName || "unknown";
|
||||
if (!groups[key])
|
||||
groups[key] = {
|
||||
icon: n.appIcon,
|
||||
resolvedIcon: "",
|
||||
name: n.appName,
|
||||
count: 0
|
||||
};
|
||||
if (!groups[key].resolvedIcon && n.resolvedIcon)
|
||||
groups[key].resolvedIcon = n.resolvedIcon;
|
||||
groups[key].count++;
|
||||
}
|
||||
return Object.values(groups);
|
||||
|
|
@ -62,14 +63,7 @@ Row {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 14
|
||||
height: 14
|
||||
source: {
|
||||
const icon = _pill.modelData.icon;
|
||||
if (!icon)
|
||||
return "";
|
||||
if (icon.startsWith("/"))
|
||||
return icon;
|
||||
return Quickshell.iconPath(icon) ?? "";
|
||||
}
|
||||
source: _pill.modelData.resolvedIcon || ""
|
||||
sourceSize: Qt.size(14, 14)
|
||||
visible: source !== ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue