From 604321e30ef1456b2bd8f85831c826f5e03a0798 Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Tue, 19 Aug 2025 19:04:38 -0700 Subject: [PATCH 1/2] add app icon to active window, fix app icon method in dock --- Modules/Bar/ActiveWindow.qml | 31 ++++++++++++++++++++++++------- Modules/Dock/Dock.qml | 8 +------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Modules/Bar/ActiveWindow.qml b/Modules/Bar/ActiveWindow.qml index 1335a45..7e54e82 100644 --- a/Modules/Bar/ActiveWindow.qml +++ b/Modules/Bar/ActiveWindow.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import Quickshell +import Quickshell.Widgets import qs.Commons import qs.Services import qs.Widgets @@ -42,6 +43,15 @@ Row { const focusedWindow = CompositorService.getFocusedWindow() return focusedWindow ? (focusedWindow.title || focusedWindow.appId || "") : "" } + + function getAppIcon() { + const focusedWindow = CompositorService.getFocusedWindow(); + if (!focusedWindow || !focusedWindow.appId) + return ""; + + let icon = Quickshell.iconPath(DesktopEntries.byId(focusedWindow.appId).icon); + return icon || ""; + } // A hidden text element to safely measure the full title width NText { @@ -72,13 +82,20 @@ Row { spacing: Style.marginXS * scaling // Window icon - NIcon { - id: windowIcon - text: "dialogs" - font.pointSize: Style.fontSizeL * scaling - verticalAlignment: Text.AlignVCenter - anchors.verticalCenter: parent.verticalCenter - visible: getTitle() !== "" + Item { + width: Style.fontSizeL * scaling * 1.2 + height: Style.fontSizeL * scaling * 1.2 + anchors.verticalCenter: parent.verticalCenter + visible: getTitle() !== "" + + IconImage { + id: windowIcon + anchors.fill: parent + source: getAppIcon() + asynchronous: true + smooth: true + visible: source !== "" + } } NText { diff --git a/Modules/Dock/Dock.qml b/Modules/Dock/Dock.qml index 3b9503e..2b72f69 100644 --- a/Modules/Dock/Dock.qml +++ b/Modules/Dock/Dock.qml @@ -159,13 +159,7 @@ NLoader { function getAppIcon(toplevel: Toplevel): string { if (!toplevel) return "" - let icon = Quickshell.iconPath(toplevel.appId?.toLowerCase(), true) - if (!icon) - icon = Quickshell.iconPath(toplevel.appId, true) - if (!icon) - icon = Quickshell.iconPath(toplevel.title?.toLowerCase(), true) - if (!icon) - icon = Quickshell.iconPath(toplevel.title, true) + let icon = Quickshell.iconPath(DesktopEntries.byId(toplevel.appId?.toLowerCase()).icon); return icon || Quickshell.iconPath("application-x-executable", true) } From db060fe5bb78f1859ec9e0027d72188f6fcb2ffd Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Wed, 20 Aug 2025 07:57:19 -0700 Subject: [PATCH 2/2] add toggle for showing/hiding active window icon --- Commons/Settings.qml | 1 + Modules/Bar/ActiveWindow.qml | 2 +- Modules/SettingsPanel/Tabs/BarTab.qml | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index bc5d6c4..102dbbd 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -111,6 +111,7 @@ Singleton { bar: JsonObject { property string position: "top" // Possible values: "top", "bottom" property bool showActiveWindow: true + property bool showActiveWindowIcon: true property bool showSystemInfo: false property bool showMedia: false property bool showBrightness: true diff --git a/Modules/Bar/ActiveWindow.qml b/Modules/Bar/ActiveWindow.qml index 7e54e82..40a154f 100644 --- a/Modules/Bar/ActiveWindow.qml +++ b/Modules/Bar/ActiveWindow.qml @@ -86,7 +86,7 @@ Row { width: Style.fontSizeL * scaling * 1.2 height: Style.fontSizeL * scaling * 1.2 anchors.verticalCenter: parent.verticalCenter - visible: getTitle() !== "" + visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon IconImage { id: windowIcon diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index f3f26da..328b5ca 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -87,6 +87,15 @@ ColumnLayout { } } + NToggle { + label: "Show App Icon Next To Active Window" + description: "Display the app icon next to the title of the currently focused window." + checked: Settings.data.bar.showActiveWindowIcon + onToggled: checked => { + Settings.data.bar.showActiveWindowIcon = checked + } + } + NToggle { label: "Show System Info" description: "Display system statistics (CPU, RAM, Temperature)."