notifs: use Quickshell.iconPath() for app icon lookup — fixes broken icons when appIcon is a name not a path
This commit is contained in:
parent
188cecbb42
commit
e1565bdd59
2 changed files with 19 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import Quickshell.Services.Notifications
|
import Quickshell.Services.Notifications
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
|
|
@ -237,7 +238,15 @@ M.HoverPanel {
|
||||||
anchors.topMargin: 6
|
anchors.topMargin: 6
|
||||||
width: 24
|
width: 24
|
||||||
height: 24
|
height: 24
|
||||||
source: notifItem.modelData.image || notifItem.modelData.appIcon || ""
|
source: {
|
||||||
|
const img = notifItem.modelData.image;
|
||||||
|
if (img)
|
||||||
|
return img;
|
||||||
|
const ic = notifItem.modelData.appIcon;
|
||||||
|
if (!ic)
|
||||||
|
return "";
|
||||||
|
return ic.startsWith("/") ? ic : Quickshell.iconPath(ic, "dialog-information");
|
||||||
|
}
|
||||||
visible: status === Image.Ready
|
visible: status === Image.Ready
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
sourceSize: Qt.size(24, 24)
|
sourceSize: Qt.size(24, 24)
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,15 @@ PanelWindow {
|
||||||
anchors.topMargin: 8
|
anchors.topMargin: 8
|
||||||
width: 36
|
width: 36
|
||||||
height: 36
|
height: 36
|
||||||
source: popupItem.modelData.image || popupItem.modelData.appIcon || ""
|
source: {
|
||||||
|
const img = popupItem.modelData.image;
|
||||||
|
if (img)
|
||||||
|
return img;
|
||||||
|
const ic = popupItem.modelData.appIcon;
|
||||||
|
if (!ic)
|
||||||
|
return "";
|
||||||
|
return ic.startsWith("/") ? ic : Quickshell.iconPath(ic, "dialog-information");
|
||||||
|
}
|
||||||
visible: status === Image.Ready
|
visible: status === Image.Ready
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
sourceSize: Qt.size(36, 36)
|
sourceSize: Qt.size(36, 36)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue