1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

notifications: add image persistence

This commit is contained in:
bbedward
2026-01-03 19:56:08 -05:00
parent 913bb2ff67
commit aa72eacae7
5 changed files with 93 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ Variants {
}
pluginService: (liveInstanceData.widgetType !== "desktopClock" && liveInstanceData.widgetType !== "systemMonitor") ? PluginService : null
screen: screenDelegate.screen
visible: shouldBeVisible
widgetEnabled: shouldBeVisible
}
}
}

View File

@@ -362,6 +362,7 @@ PanelWindow {
id: iconContainer
readonly property bool hasNotificationImage: notificationData && notificationData.image && notificationData.image !== ""
readonly property bool needsImagePersist: hasNotificationImage && notificationData.image.startsWith("image://qsimage/") && !notificationData.persistedImagePath
width: 63
height: 63
@@ -391,6 +392,22 @@ PanelWindow {
const appName = notificationData?.appName || "?";
return appName.charAt(0).toUpperCase();
}
onImageStatusChanged: {
if (imageStatus === Image.Ready && needsImagePersist) {
const cachePath = NotificationService.getImageCachePath(notificationData);
saveImageToFile(cachePath);
}
}
onImageSaved: filePath => {
if (!notificationData)
return;
notificationData.persistedImagePath = filePath;
const wrapperId = notificationData.notification?.id?.toString() || "";
if (wrapperId)
NotificationService.updateHistoryImage(wrapperId, filePath);
}
}
Rectangle {

View File

@@ -17,6 +17,7 @@ Item {
property var pluginService: null
property string instanceId: ""
property var instanceData: null
property bool widgetEnabled: true
readonly property bool isBuiltin: pluginId === "desktopClock" || pluginId === "systemMonitor"
readonly property var activeComponent: isBuiltin ? builtinComponent : PluginService.pluginDesktopComponents[pluginId] ?? null
@@ -202,7 +203,7 @@ Item {
PanelWindow {
id: widgetWindow
screen: root.screen
visible: root.visible && root.activeComponent !== null
visible: root.widgetEnabled && root.activeComponent !== null
color: "transparent"
WlrLayershell.namespace: "quickshell:desktop-widget:" + root.pluginId + (root.instanceId ? ":" + root.instanceId : "")