mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 15:02:50 -05:00
Implement icon for niri screenshots
- Fixed debug icon warning logic - Add linux os environment script
This commit is contained in:
@@ -80,6 +80,7 @@ Singleton {
|
||||
readonly property bool isConversation: detectIsConversation()
|
||||
readonly property bool isMedia: detectIsMedia()
|
||||
readonly property bool isSystem: detectIsSystem()
|
||||
readonly property bool isScreenshot: detectIsScreenshot()
|
||||
|
||||
function detectIsConversation() {
|
||||
const appNameLower = appName.toLowerCase();
|
||||
@@ -121,6 +122,25 @@ Singleton {
|
||||
summaryLower.includes("system");
|
||||
}
|
||||
|
||||
function detectIsScreenshot() {
|
||||
const appNameLower = appName.toLowerCase();
|
||||
const summaryLower = summary.toLowerCase();
|
||||
const bodyLower = body.toLowerCase();
|
||||
const imageLower = image.toLowerCase();
|
||||
|
||||
// Detect niri screenshot notifications
|
||||
return appNameLower.includes("niri") &&
|
||||
(summaryLower.includes("screenshot") ||
|
||||
bodyLower.includes("screenshot") ||
|
||||
imageLower.includes("screenshot") ||
|
||||
imageLower.includes("pictures/screenshots")) ||
|
||||
summaryLower.includes("screenshot") ||
|
||||
bodyLower.includes("screenshot taken") ||
|
||||
// Detect screenshot file paths being used as images/icons
|
||||
imageLower.includes("/screenshots/") ||
|
||||
imageLower.includes("screenshot from");
|
||||
}
|
||||
|
||||
readonly property Timer timer: Timer {
|
||||
running: wrapper.popup
|
||||
interval: wrapper.notification.expireTimeout > 0 ? wrapper.notification.expireTimeout : 5000 // 5 second default
|
||||
@@ -165,12 +185,13 @@ Singleton {
|
||||
|
||||
function getNotificationIcon(wrapper) {
|
||||
// Priority 1: Use notification image if available (Discord avatars, etc.)
|
||||
if (wrapper.hasImage) {
|
||||
// BUT NOT for screenshots - they use file paths which shouldn't be loaded as icons
|
||||
if (wrapper.hasImage && !wrapper.isScreenshot) {
|
||||
return wrapper.image;
|
||||
}
|
||||
|
||||
// Priority 2: Use app icon if available
|
||||
if (wrapper.hasAppIcon) {
|
||||
// Priority 2: Use app icon if available and not a screenshot
|
||||
if (wrapper.hasAppIcon && !wrapper.isScreenshot) {
|
||||
return Quickshell.iconPath(wrapper.appIcon, "image-missing");
|
||||
}
|
||||
|
||||
@@ -179,7 +200,9 @@ Singleton {
|
||||
}
|
||||
|
||||
function getFallbackIcon(wrapper) {
|
||||
if (wrapper.isConversation) {
|
||||
if (wrapper.isScreenshot) {
|
||||
return Quickshell.iconPath("screenshot_monitor");
|
||||
} else if (wrapper.isConversation) {
|
||||
return Quickshell.iconPath("chat-symbolic");
|
||||
} else if (wrapper.isMedia) {
|
||||
return Quickshell.iconPath("audio-x-generic-symbolic");
|
||||
@@ -190,7 +213,7 @@ Singleton {
|
||||
}
|
||||
|
||||
function getAppIconPath(wrapper) {
|
||||
if (wrapper.hasAppIcon) {
|
||||
if (wrapper.hasAppIcon && !wrapper.isScreenshot) {
|
||||
return Quickshell.iconPath(wrapper.appIcon);
|
||||
}
|
||||
return getFallbackIcon(wrapper);
|
||||
@@ -264,6 +287,11 @@ Singleton {
|
||||
return `${appName}:conversation`;
|
||||
}
|
||||
|
||||
// Screenshots: Group all screenshots together
|
||||
if (wrapper.isScreenshot) {
|
||||
return "screenshots";
|
||||
}
|
||||
|
||||
// Media: Replace previous media notification from same app
|
||||
if (wrapper.isMedia) {
|
||||
return `${appName}:media`;
|
||||
@@ -303,7 +331,8 @@ Singleton {
|
||||
hasInlineReply: false,
|
||||
isConversation: notif.isConversation,
|
||||
isMedia: notif.isMedia,
|
||||
isSystem: notif.isSystem
|
||||
isSystem: notif.isSystem,
|
||||
isScreenshot: notif.isScreenshot
|
||||
};
|
||||
}
|
||||
|
||||
@@ -336,7 +365,8 @@ Singleton {
|
||||
hasInlineReply: false,
|
||||
isConversation: notif.isConversation,
|
||||
isMedia: notif.isMedia,
|
||||
isSystem: notif.isSystem
|
||||
isSystem: notif.isSystem,
|
||||
isScreenshot: notif.isScreenshot
|
||||
};
|
||||
}
|
||||
|
||||
@@ -400,6 +430,13 @@ Singleton {
|
||||
return "Now playing";
|
||||
}
|
||||
|
||||
if (group.isScreenshot) {
|
||||
if (group.count === 1) {
|
||||
return "Screenshot saved";
|
||||
}
|
||||
return `${group.count} screenshots saved`;
|
||||
}
|
||||
|
||||
if (group.isSystem) {
|
||||
const keyParts = group.key.split(":");
|
||||
if (keyParts.length > 1) {
|
||||
@@ -434,6 +471,10 @@ Singleton {
|
||||
return group.latestNotification.body || "Media playback";
|
||||
}
|
||||
|
||||
if (group.isScreenshot) {
|
||||
return group.latestNotification.body || "Screenshot available in Pictures/Screenshots";
|
||||
}
|
||||
|
||||
return `Latest: ${group.latestNotification.summary}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user