mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
Fix: missing system logo and app icons on Guix System (#616)
* Fix for Guix logo not being shown * Fixed icons not being shown in Workspace Switcher. Also added a DesktopService with a function to get the icon path * Fixed some icons not being shown + Icons in app drawer * Fixed icons not appearing in Spotlight * Adapted missing icons in app launcher/spotlight * Removed (now) useless change
This commit is contained in:
committed by
GitHub
parent
69accb5319
commit
946a28d3be
@@ -162,13 +162,13 @@ Item {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyBase = (w.app_id || w.appId || w.class || w.windowClass || "unknown").toLowerCase()
|
const keyBase = (w.app_id || w.appId || w.class || w.windowClass || "unknown")
|
||||||
const key = isActiveWs ? `${keyBase}_${i}` : keyBase
|
const key = isActiveWs ? `${keyBase}_${i}` : keyBase
|
||||||
|
|
||||||
if (!byApp[key]) {
|
if (!byApp[key]) {
|
||||||
const moddedId = Paths.moddedAppId(keyBase)
|
const moddedId = Paths.moddedAppId(keyBase)
|
||||||
const isSteamApp = moddedId.toLowerCase().includes("steam_app")
|
const isSteamApp = moddedId.toLowerCase().includes("steam_app")
|
||||||
const icon = isSteamApp ? "" : Quickshell.iconPath(DesktopEntries.heuristicLookup(moddedId)?.icon, true)
|
const icon = isSteamApp ? "" : DesktopService.resolveIconPath(moddedId)
|
||||||
byApp[key] = {
|
byApp[key] = {
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
"icon": icon,
|
"icon": icon,
|
||||||
|
|||||||
63
Services/DesktopService.qml
Normal file
63
Services/DesktopService.qml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
function resolveIconPath(moddedAppId) {
|
||||||
|
const entry = DesktopEntries.heuristicLookup(moddedAppId)
|
||||||
|
const appIds = [moddedAppId, moddedAppId.toLowerCase()];
|
||||||
|
|
||||||
|
const lastPart = moddedAppId.split('.').pop();
|
||||||
|
if (lastPart && lastPart !== moddedAppId) {
|
||||||
|
appIds.push(lastPart);
|
||||||
|
|
||||||
|
const firstChar = lastPart.charAt(0);
|
||||||
|
const rest = lastPart.slice(1);
|
||||||
|
let toggled;
|
||||||
|
|
||||||
|
if (firstChar === firstChar.toLowerCase()) {
|
||||||
|
toggled = firstChar.toUpperCase() + rest;
|
||||||
|
} else {
|
||||||
|
toggled = firstChar.toLowerCase() + rest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toggled !== lastPart) {
|
||||||
|
appIds.push(toggled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const appId of appIds){
|
||||||
|
let icon = Quickshell.iconPath(entry?.icon, true)
|
||||||
|
console.log(icon)
|
||||||
|
if (icon && icon !== "") return icon
|
||||||
|
|
||||||
|
let execPath = entry?.execString?.replace(/\/bin.*/, "")
|
||||||
|
console.log(execPath)
|
||||||
|
if (!execPath) continue
|
||||||
|
|
||||||
|
//Check that the app is installed with nix/guix
|
||||||
|
if (execPath.startsWith("/nix/store/") || execPath.startsWith("/gnu/store/")) {
|
||||||
|
const basePath = execPath
|
||||||
|
const sizes = ["256x256", "128x128", "64x64", "48x48", "32x32", "24x24", "16x16"]
|
||||||
|
|
||||||
|
let iconPath = `${basePath}/share/icons/hicolor/scalable/apps/${appId}.svg`
|
||||||
|
icon = Quickshell.iconPath(iconPath, true)
|
||||||
|
console.log(icon)
|
||||||
|
if (icon && icon !== "") return icon
|
||||||
|
|
||||||
|
for (const size of sizes) {
|
||||||
|
iconPath = `${basePath}/share/icons/hicolor/${size}/apps/${appId}.png`
|
||||||
|
icon = Quickshell.iconPath(iconPath, true)
|
||||||
|
console.log(icon)
|
||||||
|
if (icon && icon !== "") return icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -26,7 +27,7 @@ Item {
|
|||||||
readonly property bool isUnicode: iconValue.startsWith("unicode:")
|
readonly property bool isUnicode: iconValue.startsWith("unicode:")
|
||||||
readonly property string materialName: isMaterial ? iconValue.substring(9) : ""
|
readonly property string materialName: isMaterial ? iconValue.substring(9) : ""
|
||||||
readonly property string unicodeChar: isUnicode ? iconValue.substring(8) : ""
|
readonly property string unicodeChar: isUnicode ? iconValue.substring(8) : ""
|
||||||
readonly property string iconPath: isMaterial || isUnicode ? "" : Quickshell.iconPath(iconValue, true)
|
readonly property string iconPath: isMaterial || isUnicode ? "" : Quickshell.iconPath(iconValue, true) || DesktopService.resolveIconPath(iconValue)
|
||||||
|
|
||||||
visible: iconValue !== undefined && iconValue !== ""
|
visible: iconValue !== undefined && iconValue !== ""
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Rectangle {
|
|||||||
width: computedIconSize
|
width: computedIconSize
|
||||||
height: computedIconSize
|
height: computedIconSize
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
iconValue: model.icon || ""
|
iconValue: model.icon && model.icon !== "" ? model.icon : model.startupClass
|
||||||
iconSize: computedIconSize
|
iconSize: computedIconSize
|
||||||
fallbackText: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
|
fallbackText: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
|
||||||
materialIconSizeAdjustment: root.iconMaterialSizeAdjustment
|
materialIconSizeAdjustment: root.iconMaterialSizeAdjustment
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Rectangle {
|
|||||||
width: root.iconSize
|
width: root.iconSize
|
||||||
height: root.iconSize
|
height: root.iconSize
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
iconValue: model.icon || ""
|
iconValue: model.icon && model.icon !== "" ? model.icon : model.startupClass
|
||||||
iconSize: root.iconSize
|
iconSize: root.iconSize
|
||||||
fallbackText: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
|
fallbackText: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
|
||||||
iconMargins: root.iconMargins
|
iconMargins: root.iconMargins
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ IconImage {
|
|||||||
source = "file:///usr/share/icons/cachyos.svg"
|
source = "file:///usr/share/icons/cachyos.svg"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
else if (logo === "guix-icon")
|
||||||
|
{
|
||||||
|
source = "file:///run/current-system/profile/share/icons/hicolor/scalable/apps/guix-icon.svg"
|
||||||
|
return
|
||||||
|
}
|
||||||
source = Quickshell.iconPath(logo, true)
|
source = Quickshell.iconPath(logo, true)
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user