From cc6766135d3244a9f93c3c56e171c7cd295faf2e Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 16 Mar 2026 11:25:50 -0400 Subject: [PATCH] focused app: fallback to app name if no title in compact mode fixes #2005 --- .../Modules/DankBar/Widgets/FocusedApp.qml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/quickshell/Modules/DankBar/Widgets/FocusedApp.qml b/quickshell/Modules/DankBar/Widgets/FocusedApp.qml index c0446311..a177121c 100644 --- a/quickshell/Modules/DankBar/Widgets/FocusedApp.qml +++ b/quickshell/Modules/DankBar/Widgets/FocusedApp.qml @@ -87,11 +87,11 @@ BasePill { } const workspaceWindows = NiriService.windows.filter(w => w.workspace_id === currentWorkspaceId); - return workspaceWindows.length > 0 && activeWindow && activeWindow.title; + return workspaceWindows.length > 0 && activeWindow && (activeWindow.title || activeWindow.appId); } if (CompositorService.isHyprland) { - if (!Hyprland.focusedWorkspace || !activeWindow || !activeWindow.title) { + if (!Hyprland.focusedWorkspace || !activeWindow || !(activeWindow.title || activeWindow.appId)) { return false; } @@ -111,7 +111,7 @@ BasePill { } } - return activeWindow && activeWindow.title; + return activeWindow && (activeWindow.title || activeWindow.appId); } width: hasWindowsOnCurrentWorkspace ? (isVerticalOrientation ? barThickness : visualWidth) : 0 @@ -212,17 +212,19 @@ BasePill { const title = activeWindow && activeWindow.title ? activeWindow.title : ""; const appName = appText.text; - if (compactMode && title === appName) { + if (compactMode) { + if (!title || title === appName) + return title || appName; + if (title.endsWith(appName)) + return title.substring(0, title.length - appName.length).replace(/ (-|—) $/, "") || appName; return title; } - if (!title || !appName) { + if (!title || !appName) return title; - } - if (title.endsWith(appName)) { + if (title.endsWith(appName)) return title.substring(0, title.length - appName.length).replace(/ (-|—) $/, ""); - } return title; }