fix(hyprland): correct focusedWindowIndex after sorting window list

This commit is contained in:
Lysec
2026-03-17 11:23:11 +01:00
parent e39ff3a815
commit 5e95658fa9
+13 -2
View File
@@ -246,7 +246,7 @@ Item {
}
const hlToplevels = Hyprland.toplevels.values;
let newFocusedIndex = -1;
let focusedWindowId = null;
// Get active workspaces to filter focus
const activeWorkspaceIds = {};
@@ -288,13 +288,24 @@ Item {
windowCache[normalized.id] = normalized;
if (normalized.isFocused) {
newFocusedIndex = windowsList.length - 1;
focusedWindowId = normalized.id;
}
}
}
windows = toSortedWindowList(windowsList);
// Resolve focused index from sorted list (order changes after sort)
let newFocusedIndex = -1;
if (focusedWindowId) {
for (let k = 0; k < windows.length; k++) {
if (windows[k].id === focusedWindowId) {
newFocusedIndex = k;
break;
}
}
}
if (newFocusedIndex !== focusedWindowIndex) {
focusedWindowIndex = newFocusedIndex;
activeWindowChanged();