From a3baf8ce3168d6663925f090cca969ef9a4e43e0 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 12 Feb 2026 14:51:10 -0500 Subject: [PATCH] running apps: fix focusing of windows when grouped --- .../Modules/DankBar/Widgets/RunningApps.qml | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/quickshell/Modules/DankBar/Widgets/RunningApps.qml b/quickshell/Modules/DankBar/Widgets/RunningApps.qml index b862a702..daa690a5 100644 --- a/quickshell/Modules/DankBar/Widgets/RunningApps.qml +++ b/quickshell/Modules/DankBar/Widgets/RunningApps.qml @@ -227,7 +227,21 @@ BasePill { property bool isGrouped: root._groupByApp property var groupData: isGrouped ? modelData : null property var toplevelData: isGrouped ? (modelData.windows.length > 0 ? modelData.windows[0].toplevel : null) : modelData - property bool isFocused: toplevelData ? toplevelData.activated : false + property bool isFocused: { + if (!isGrouped) + return toplevelData ? toplevelData.activated : false; + const toplevels = CompositorService.sortedToplevels; + if (!toplevels) + return false; + let result = false; + for (let i = 0; i < toplevels.length; i++) { + if ((toplevels[i].appId || "") !== appId) + continue; + if (toplevels[i].activated) + result = true; + } + return result; + } property string appId: isGrouped ? modelData.appId : (modelData.appId || "") property string windowTitle: toplevelData ? (toplevelData.title || "(Unnamed)") : "(Unnamed)" property var toplevelObject: toplevelData @@ -482,7 +496,21 @@ BasePill { property bool isGrouped: root._groupByApp property var groupData: isGrouped ? modelData : null property var toplevelData: isGrouped ? (modelData.windows.length > 0 ? modelData.windows[0].toplevel : null) : modelData - property bool isFocused: toplevelData ? toplevelData.activated : false + property bool isFocused: { + if (!isGrouped) + return toplevelData ? toplevelData.activated : false; + const toplevels = CompositorService.sortedToplevels; + if (!toplevels) + return false; + let result = false; + for (let i = 0; i < toplevels.length; i++) { + if ((toplevels[i].appId || "") !== appId) + continue; + if (toplevels[i].activated) + result = true; + } + return result; + } property string appId: isGrouped ? modelData.appId : (modelData.appId || "") property string windowTitle: toplevelData ? (toplevelData.title || "(Unnamed)") : "(Unnamed)" property var toplevelObject: toplevelData