mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
steam_app icon handling
This commit is contained in:
@@ -264,7 +264,11 @@ Item {
|
|||||||
if (appData.appId === "__SEPARATOR__") {
|
if (appData.appId === "__SEPARATOR__") {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
const desktopEntry = DesktopEntries.heuristicLookup(Paths.moddedAppId(appData.appId))
|
const moddedId = Paths.moddedAppId(appData.appId)
|
||||||
|
if (moddedId.toLowerCase().includes("steam_app")) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
const desktopEntry = DesktopEntries.heuristicLookup(moddedId)
|
||||||
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : ""
|
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : ""
|
||||||
}
|
}
|
||||||
mipmap: true
|
mipmap: true
|
||||||
@@ -273,6 +277,20 @@ Item {
|
|||||||
visible: status === Image.Ready
|
visible: status === Image.Ready
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
size: 40
|
||||||
|
name: "sports_esports"
|
||||||
|
color: Theme.surfaceText
|
||||||
|
visible: {
|
||||||
|
if (!appData || !appData.appId || appData.appId === "__SEPARATOR__") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const moddedId = Paths.moddedAppId(appData.appId)
|
||||||
|
return moddedId.toLowerCase().includes("steam_app")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
|
|||||||
@@ -213,17 +213,40 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 18
|
width: 18
|
||||||
height: 18
|
height: 18
|
||||||
source: Quickshell.iconPath(DesktopEntries.heuristicLookup(Paths.moddedAppId(appId))?.icon, true)
|
source: {
|
||||||
|
const moddedId = Paths.moddedAppId(appId)
|
||||||
|
if (moddedId.toLowerCase().includes("steam_app")) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return Quickshell.iconPath(DesktopEntries.heuristicLookup(moddedId)?.icon, true)
|
||||||
|
}
|
||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: status === Image.Ready
|
visible: status === Image.Ready
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - 18) / 2 : Theme.spacingXS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
size: 18
|
||||||
|
name: "sports_esports"
|
||||||
|
color: Theme.surfaceText
|
||||||
|
visible: {
|
||||||
|
const moddedId = Paths.moddedAppId(appId)
|
||||||
|
return moddedId.toLowerCase().includes("steam_app")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fallback text if no icon found
|
// Fallback text if no icon found
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: !iconImg.visible
|
visible: {
|
||||||
|
const moddedId = Paths.moddedAppId(appId)
|
||||||
|
const isSteamApp = moddedId.toLowerCase().includes("steam_app")
|
||||||
|
return !iconImg.visible && !isSteamApp
|
||||||
|
}
|
||||||
text: {
|
text: {
|
||||||
if (!appId) {
|
if (!appId) {
|
||||||
return "?";
|
return "?";
|
||||||
|
|||||||
@@ -84,10 +84,13 @@ Rectangle {
|
|||||||
const key = isActiveWs ? `${keyBase}_${i}` : keyBase
|
const key = isActiveWs ? `${keyBase}_${i}` : keyBase
|
||||||
|
|
||||||
if (!byApp[key]) {
|
if (!byApp[key]) {
|
||||||
const icon = Quickshell.iconPath(DesktopEntries.heuristicLookup(Paths.moddedAppId(keyBase))?.icon, true)
|
const moddedId = Paths.moddedAppId(keyBase)
|
||||||
|
const isSteamApp = moddedId.toLowerCase().includes("steam_app")
|
||||||
|
const icon = isSteamApp ? "" : Quickshell.iconPath(DesktopEntries.heuristicLookup(moddedId)?.icon, true)
|
||||||
byApp[key] = {
|
byApp[key] = {
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
"icon": icon,
|
"icon": icon,
|
||||||
|
"isSteamApp": isSteamApp,
|
||||||
"active": !!(w.activated || (CompositorService.isNiri && w.is_focused)),
|
"active": !!(w.activated || (CompositorService.isNiri && w.is_focused)),
|
||||||
"count": 1,
|
"count": 1,
|
||||||
"windowId": w.address || w.id,
|
"windowId": w.address || w.id,
|
||||||
@@ -347,18 +350,29 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
MouseArea {
|
visible: !modelData.isSteamApp
|
||||||
id: appMouseArea
|
}
|
||||||
hoverEnabled: true
|
|
||||||
anchors.fill: parent
|
DankIcon {
|
||||||
enabled: isActive
|
anchors.centerIn: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
size: 18
|
||||||
onClicked: {
|
name: "sports_esports"
|
||||||
if (CompositorService.isHyprland) {
|
color: Theme.surfaceText
|
||||||
Hyprland.dispatch(`focuswindow address:${appIcon.windowId}`)
|
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
} else if (CompositorService.isNiri) {
|
visible: modelData.isSteamApp
|
||||||
NiriService.focusWindow(appIcon.windowId)
|
}
|
||||||
}
|
|
||||||
|
MouseArea {
|
||||||
|
id: appMouseArea
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: isActive
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
if (CompositorService.isHyprland) {
|
||||||
|
Hyprland.dispatch(`focuswindow address:${appIcon.windowId}`)
|
||||||
|
} else if (CompositorService.isNiri) {
|
||||||
|
NiriService.focusWindow(appIcon.windowId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user