From dbf2b58b7f38571f54da480a196640e3e0a13dc3 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 21 Jul 2025 20:56:33 -0400 Subject: [PATCH] fix focus window lookups --- Services/FocusedWindowService.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Services/FocusedWindowService.qml b/Services/FocusedWindowService.qml index a22940fd..cfbaabbc 100644 --- a/Services/FocusedWindowService.qml +++ b/Services/FocusedWindowService.qml @@ -90,11 +90,23 @@ Singleton { Connections { function onFocusedWindowIdChanged() { - root.focusedWindowId = parseInt(NiriWorkspaceService.focusedWindowId) || -1; - updateFromNiriData(); + const focusedWindowId = NiriWorkspaceService.focusedWindowId; + if (!focusedWindowId) { + clearFocusedWindow(); + return; + } + + const focusedWindow = NiriWorkspaceService.windows.find(w => w.id == focusedWindowId); + if (focusedWindow) { + root.focusedAppId = focusedWindow.app_id || ""; + root.focusedWindowTitle = focusedWindow.title || ""; + root.focusedAppName = getDisplayName(focusedWindow.app_id || ""); + root.focusedWindowId = parseInt(focusedWindow.id) || -1; + } else { + clearFocusedWindow(); + } } - function onWindowsChanged() { updateFromNiriData(); }