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
|
||||
import "../modules" as M
|
||||
|
||||
|
|
@ -76,12 +75,14 @@ Column {
|
|||
if (!map[key])
|
||||
map[key] = {
|
||||
appName: key,
|
||||
appIcon: n.appIcon,
|
||||
resolvedIcon: "",
|
||||
notifs: [],
|
||||
maxUrgency: 0,
|
||||
maxTime: 0
|
||||
};
|
||||
map[key].notifs.push(n);
|
||||
if (!map[key].resolvedIcon && n.resolvedIcon)
|
||||
map[key].resolvedIcon = n.resolvedIcon;
|
||||
if (n.urgency > map[key].maxUrgency)
|
||||
map[key].maxUrgency = n.urgency;
|
||||
if (n.time > map[key].maxTime)
|
||||
|
|
@ -101,7 +102,7 @@ Column {
|
|||
arr.push({
|
||||
type: "header",
|
||||
appName: g.appName,
|
||||
appIcon: g.appIcon,
|
||||
resolvedIcon: g.resolvedIcon,
|
||||
count: g.notifs.length,
|
||||
collapsed: collapsed,
|
||||
summaries: g.notifs.map(n => n.summary || "")
|
||||
|
|
@ -299,14 +300,7 @@ Column {
|
|||
anchors.topMargin: (28 - height) / 2
|
||||
width: S.Theme.fontSize + 2
|
||||
height: S.Theme.fontSize + 2
|
||||
source: {
|
||||
if (notifDelegate._type !== "header")
|
||||
return "";
|
||||
const ic = notifDelegate.modelData.appIcon;
|
||||
if (!ic)
|
||||
return "";
|
||||
return (ic.startsWith("/") || ic.startsWith("file://")) ? ic : Quickshell.iconPath(ic, "dialog-information");
|
||||
}
|
||||
source: notifDelegate._type === "header" ? (notifDelegate.modelData.resolvedIcon || "") : ""
|
||||
visible: status === Image.Ready
|
||||
fillMode: Image.PreserveAspectFit
|
||||
sourceSize: Qt.size(S.Theme.fontSize + 2, S.Theme.fontSize + 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue