1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

Merge pull request #127 from gonengazit/master

change DesktopEntries.byId to DesktopEntries.heuristicLookup
This commit is contained in:
BB
2025-08-29 11:48:39 -04:00
committed by GitHub
4 changed files with 11 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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