mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 15:32:50 -05:00
feat: map steam_app_ID to steam_icon_ID for actual game icons (#1312)
Steam Proton games use window class steam_app_XXXXX. Steam installs icons as steam_icon_XXXXX. This maps between them so actual game icons display instead of generic controller fallback.
This commit is contained in:
@@ -59,6 +59,9 @@ Singleton {
|
|||||||
return "transmission";
|
return "transmission";
|
||||||
return "transmission-gtk";
|
return "transmission-gtk";
|
||||||
}
|
}
|
||||||
|
const steamMatch = appId.match(/^steam_app_(\d+)$/);
|
||||||
|
if (steamMatch)
|
||||||
|
return `steam_icon_${steamMatch[1]}`;
|
||||||
return appId;
|
return appId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +71,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const moddedId = moddedAppId(appId);
|
const moddedId = moddedAppId(appId);
|
||||||
if (moddedId.toLowerCase().includes("steam_app")) {
|
if (moddedId.startsWith("steam_icon_")) {
|
||||||
return "";
|
return Quickshell.iconPath(moddedId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : "";
|
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : "";
|
||||||
|
|||||||
@@ -148,29 +148,9 @@ BasePill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
size: 18
|
|
||||||
name: "sports_esports"
|
|
||||||
color: Theme.widgetTextColor
|
|
||||||
visible: {
|
|
||||||
if (!root.isVerticalOrientation || !activeWindow || !activeWindow.appId)
|
|
||||||
return false;
|
|
||||||
const moddedId = Paths.moddedAppId(activeWindow.appId);
|
|
||||||
return moddedId.toLowerCase().includes("steam_app");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: {
|
visible: root.isVerticalOrientation && activeWindow && activeWindow.appId && appIcon.status !== Image.Ready
|
||||||
if (!root.isVerticalOrientation || !activeWindow || !activeWindow.appId)
|
|
||||||
return false;
|
|
||||||
if (appIcon.status === Image.Ready)
|
|
||||||
return false;
|
|
||||||
const moddedId = Paths.moddedAppId(activeWindow.appId);
|
|
||||||
return !moddedId.toLowerCase().includes("steam_app");
|
|
||||||
}
|
|
||||||
text: {
|
text: {
|
||||||
if (!activeWindow || !activeWindow.appId)
|
if (!activeWindow || !activeWindow.appId)
|
||||||
return "?";
|
return "?";
|
||||||
|
|||||||
@@ -384,27 +384,9 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? Math.round((parent.width - Theme.barIconSize(root.barThickness)) / 2) : Theme.spacingXS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
|
||||||
name: "sports_esports"
|
|
||||||
color: Theme.widgetTextColor
|
|
||||||
visible: {
|
|
||||||
const moddedId = Paths.moddedAppId(appId);
|
|
||||||
return moddedId.toLowerCase().includes("steam_app");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback text if no icon found
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: {
|
visible: !iconImg.visible
|
||||||
const moddedId = Paths.moddedAppId(appId);
|
|
||||||
const isSteamApp = moddedId.toLowerCase().includes("steam_app");
|
|
||||||
return !iconImg.visible && !isSteamApp;
|
|
||||||
}
|
|
||||||
text: {
|
text: {
|
||||||
root._desktopEntriesUpdateTrigger;
|
root._desktopEntriesUpdateTrigger;
|
||||||
if (!appId)
|
if (!appId)
|
||||||
@@ -634,26 +616,9 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? Math.round((parent.width - Theme.barIconSize(root.barThickness)) / 2) : Theme.spacingXS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
size: Theme.barIconSize(root.barThickness)
|
|
||||||
name: "sports_esports"
|
|
||||||
color: Theme.widgetTextColor
|
|
||||||
visible: {
|
|
||||||
const moddedId = Paths.moddedAppId(appId);
|
|
||||||
return moddedId.toLowerCase().includes("steam_app");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: {
|
visible: !iconImg.visible
|
||||||
const moddedId = Paths.moddedAppId(appId);
|
|
||||||
const isSteamApp = moddedId.toLowerCase().includes("steam_app");
|
|
||||||
return !iconImg.visible && !isSteamApp;
|
|
||||||
}
|
|
||||||
text: {
|
text: {
|
||||||
root._desktopEntriesUpdateTrigger;
|
root._desktopEntriesUpdateTrigger;
|
||||||
if (!appId)
|
if (!appId)
|
||||||
|
|||||||
@@ -264,15 +264,12 @@ Item {
|
|||||||
const key = isActiveWs || !SettingsData.groupWorkspaceApps ? `${keyBase}_${i}` : keyBase;
|
const key = isActiveWs || !SettingsData.groupWorkspaceApps ? `${keyBase}_${i}` : keyBase;
|
||||||
|
|
||||||
if (!byApp[key]) {
|
if (!byApp[key]) {
|
||||||
const moddedId = Paths.moddedAppId(keyBase);
|
|
||||||
const isSteamApp = moddedId.toLowerCase().includes("steam_app");
|
|
||||||
const isQuickshell = keyBase === "org.quickshell";
|
const isQuickshell = keyBase === "org.quickshell";
|
||||||
const desktopEntry = DesktopEntries.heuristicLookup(keyBase);
|
const desktopEntry = DesktopEntries.heuristicLookup(keyBase);
|
||||||
const icon = isSteamApp ? "" : Paths.getAppIcon(keyBase, desktopEntry);
|
const icon = Paths.getAppIcon(keyBase, desktopEntry);
|
||||||
byApp[key] = {
|
byApp[key] = {
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
"icon": icon,
|
"icon": icon,
|
||||||
"isSteamApp": isSteamApp,
|
|
||||||
"isQuickshell": isQuickshell,
|
"isQuickshell": isQuickshell,
|
||||||
"active": !!((w.activated || w.is_focused) || (CompositorService.isNiri && w.is_focused)),
|
"active": !!((w.activated || w.is_focused) || (CompositorService.isNiri && w.is_focused)),
|
||||||
"count": 1,
|
"count": 1,
|
||||||
@@ -1137,7 +1134,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: !modelData.isSteamApp && !modelData.isQuickshell
|
visible: !modelData.isQuickshell
|
||||||
}
|
}
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
@@ -1153,15 +1150,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
size: root.appIconSize
|
|
||||||
name: "sports_esports"
|
|
||||||
color: Theme.widgetTextColor
|
|
||||||
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
|
||||||
visible: modelData.isSteamApp
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: rowAppMouseArea
|
id: rowAppMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -1240,7 +1228,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: !modelData.isSteamApp && !modelData.isQuickshell
|
visible: !modelData.isQuickshell
|
||||||
}
|
}
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
@@ -1256,15 +1244,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
size: root.appIconSize
|
|
||||||
name: "sports_esports"
|
|
||||||
color: Theme.widgetTextColor
|
|
||||||
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
|
||||||
visible: modelData.isSteamApp
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: colAppMouseArea
|
id: colAppMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -392,20 +392,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
size: actualIconSize
|
|
||||||
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: actualIconSize
|
width: actualIconSize
|
||||||
height: actualIconSize
|
height: actualIconSize
|
||||||
|
|||||||
Reference in New Issue
Block a user