1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 15:02:50 -05:00

change DesktopEntries.byId to DesktopEntries.heuristicLookup

If there isn't an exact id match - it also looks for the WMStartupClass
field in .desktop files
This commit is contained in:
Gonen Gazit
2025-08-29 16:52:19 +03:00
parent 64a26aabb8
commit d37ccd86ee
4 changed files with 11 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ Item {
// For window type, show app name + window title // For window type, show app name + window title
if (appData.type === "window" && showWindowTitle) { if (appData.type === "window" && showWindowTitle) {
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.heuristicLookup(appData.appId)
var appName = desktopEntry var appName = desktopEntry
&& desktopEntry.name ? desktopEntry.name : appData.appId && desktopEntry.name ? desktopEntry.name : appData.appId
return appName + (windowTitle ? " • " + windowTitle : "") return appName + (windowTitle ? " • " + windowTitle : "")
@@ -49,7 +49,7 @@ Item {
if (!appData.appId) if (!appData.appId)
return "" return ""
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.heuristicLookup(appData.appId)
return desktopEntry return desktopEntry
&& desktopEntry.name ? desktopEntry.name : appData.appId && desktopEntry.name ? desktopEntry.name : appData.appId
} }
@@ -224,7 +224,7 @@ Item {
if (appData.type === "pinned") { if (appData.type === "pinned") {
// Launch the pinned app // Launch the pinned app
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId( var desktopEntry = DesktopEntries.heuristicLookup(
appData.appId) appData.appId)
if (desktopEntry) if (desktopEntry)
AppUsageHistoryData.addAppUsage({ AppUsageHistoryData.addAppUsage({
@@ -248,7 +248,7 @@ Item {
} }
} else if (mouse.button === Qt.MiddleButton) { } else if (mouse.button === Qt.MiddleButton) {
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId( var desktopEntry = DesktopEntries.heuristicLookup(
appData.appId) appData.appId)
if (desktopEntry) if (desktopEntry)
AppUsageHistoryData.addAppUsage({ AppUsageHistoryData.addAppUsage({
@@ -279,7 +279,7 @@ Item {
implicitSize: 40 implicitSize: 40
source: { source: {
if (appData.appId === "__SEPARATOR__") return "" if (appData.appId === "__SEPARATOR__") return ""
var desktopEntry = DesktopEntries.byId(Paths.moddedAppId(appData.appId)) var desktopEntry = DesktopEntries.heuristicLookup(Paths.moddedAppId(appData.appId))
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : "" return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : ""
} }
mipmap: true mipmap: true
@@ -304,7 +304,7 @@ Item {
if (!appData || !appData.appId) if (!appData || !appData.appId)
return "?" return "?"
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.heuristicLookup(appData.appId)
if (desktopEntry && desktopEntry.name) if (desktopEntry && desktopEntry.name)
return desktopEntry.name.charAt(0).toUpperCase() return desktopEntry.name.charAt(0).toUpperCase()

View File

@@ -47,7 +47,7 @@ Rectangle {
if (!activeWindow || !activeWindow.appId) if (!activeWindow || !activeWindow.appId)
return "" return ""
var desktopEntry = DesktopEntries.byId(activeWindow.appId) var desktopEntry = DesktopEntries.heuristicLookup(activeWindow.appId)
return desktopEntry return desktopEntry
&& desktopEntry.name ? desktopEntry.name : activeWindow.appId && desktopEntry.name ? desktopEntry.name : activeWindow.appId
} }

View File

@@ -72,7 +72,7 @@ Rectangle {
property string tooltipText: { property string tooltipText: {
var appName = "Unknown" var appName = "Unknown"
if (appId) { if (appId) {
var desktopEntry = DesktopEntries.byId(appId) var desktopEntry = DesktopEntries.heuristicLookup(appId)
appName = desktopEntry appName = desktopEntry
&& desktopEntry.name ? desktopEntry.name : appId && desktopEntry.name ? desktopEntry.name : appId
} }
@@ -115,13 +115,12 @@ Rectangle {
// App icon // App icon
IconImage { IconImage {
id: iconImg id: iconImg
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - 18) / 2 : Theme.spacingXS anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - 18) / 2 : Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: 18 width: 18
height: 18 height: 18
source: Quickshell.iconPath(DesktopEntries.byId(Paths.moddedAppId(appId))?.icon, true) source: Quickshell.iconPath(DesktopEntries.heuristicLookup(Paths.moddedAppId(appId))?.icon, true)
smooth: true smooth: true
mipmap: true mipmap: true
asynchronous: true asynchronous: true
@@ -136,7 +135,7 @@ Rectangle {
if (!appId) if (!appId)
return "?" return "?"
var desktopEntry = DesktopEntries.byId(appId) var desktopEntry = DesktopEntries.heuristicLookup(appId)
if (desktopEntry && desktopEntry.name) if (desktopEntry && desktopEntry.name)
return desktopEntry.name.charAt(0).toUpperCase() return desktopEntry.name.charAt(0).toUpperCase()

View File

@@ -327,7 +327,7 @@ Singleton {
readonly property string appIcon: notification.appIcon readonly property string appIcon: notification.appIcon
readonly property string appName: { readonly property string appName: {
if (notification.appName == "") { if (notification.appName == "") {
const entry = DesktopEntries.byId(notification.desktopEntry) const entry = DesktopEntries.heuristicLookup(notification.desktopEntry)
if (entry && entry.name) { if (entry && entry.name) {
return entry.name.toLowerCase() return entry.name.toLowerCase()
} }