summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-04 21:27:17 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-04 21:27:17 +1000
commit9586f540ae01e25d832a019c0018cc5a138b4b31 (patch)
tree0b1fd2c08834664a023129b492374485cb0e5bd8
parentfeat: clear notifs shortcut (diff)
downloadcaelestia-shell-9586f540ae01e25d832a019c0018cc5a138b4b31.tar.gz
caelestia-shell-9586f540ae01e25d832a019c0018cc5a138b4b31.tar.bz2
caelestia-shell-9586f540ae01e25d832a019c0018cc5a138b4b31.zip
icons: better app icon guessing
-rw-r--r--modules/bar/popouts/ActiveWindow.qml2
-rw-r--r--utils/Icons.qml20
2 files changed, 16 insertions, 6 deletions
diff --git a/modules/bar/popouts/ActiveWindow.qml b/modules/bar/popouts/ActiveWindow.qml
index a5975ce..147b2df 100644
--- a/modules/bar/popouts/ActiveWindow.qml
+++ b/modules/bar/popouts/ActiveWindow.qml
@@ -28,7 +28,7 @@ Item {
id: icon
implicitSize: details.implicitHeight
- source: Quickshell.iconPath(DesktopEntries.applications.values.find(a => a.id === Hyprland.activeClient?.wmClass.toLowerCase())?.icon, "image-missing")
+ source: Icons.getAppIcon(Hyprland.activeClient?.wmClass ?? "")
}
Column {
diff --git a/utils/Icons.qml b/utils/Icons.qml
index 391e39c..ca3917c 100644
--- a/utils/Icons.qml
+++ b/utils/Icons.qml
@@ -102,9 +102,7 @@ Singleton {
"395": "snowing"
})
- readonly property var desktopEntrySubs: ({
- Firefox: "firefox"
- })
+ readonly property var desktopEntrySubs: ({})
readonly property var categoryIcons: ({
WebBrowser: "web",
@@ -149,9 +147,21 @@ Singleton {
property string osIcon: ""
property string osName
+ function getDesktopEntry(name: string): DesktopEntry {
+ name = name.toLowerCase().replace(/ /g, "-");
+
+ if (desktopEntrySubs.hasOwnProperty(name))
+ name = desktopEntrySubs[name];
+
+ return DesktopEntries.applications.values.find(a => a.id.toLowerCase() === name) ?? null;
+ }
+
+ function getAppIcon(name: string): string {
+ return Quickshell.iconPath(getDesktopEntry(name)?.icon, "image-missing");
+ }
+
function getAppCategoryIcon(name: string, fallback: string): string {
- const lName = name.toLowerCase();
- const categories = DesktopEntries.applications.values.find(app => app.id.toLowerCase() === lName)?.categories;
+ const categories = getDesktopEntry(name)?.categories;
if (categories)
for (const [key, value] of Object.entries(categoryIcons))