From a47960e930f7dc93640bc2e5085ba38e5201cc19 Mon Sep 17 00:00:00 2001 From: Shanu Kumawat Date: Sat, 15 Nov 2025 16:42:53 +0530 Subject: [PATCH] fix: correct focusHistoryID sort order and add pinned window priority --- modules/overview/OverviewWidget.qml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/overview/OverviewWidget.qml b/modules/overview/OverviewWidget.qml index 5490ebe..cd885f8 100644 --- a/modules/overview/OverviewWidget.qml +++ b/modules/overview/OverviewWidget.qml @@ -153,20 +153,25 @@ Item { const inWorkspaceGroup = (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) return inWorkspaceGroup; }).sort((a, b) => { - // Proper stacking order: floating windows on top, sorted by focus history + // Proper stacking order based on Hyprland's window properties const addrA = `0x${a.HyprlandToplevel.address}` const addrB = `0x${b.HyprlandToplevel.address}` const winA = windowByAddress[addrA] const winB = windowByAddress[addrB] - // Floating windows always above tiled windows + // 1. Pinned windows are always on top + if (winA?.pinned !== winB?.pinned) { + return winA?.pinned ? 1 : -1 + } + + // 2. Floating windows above tiled windows if (winA?.floating !== winB?.floating) { return winA?.floating ? 1 : -1 } - // Within same type (both floating or both tiled), sort by focus history - // Higher focusHistoryID = more recently focused = higher in stack - return (winA?.focusHistoryID ?? 0) - (winB?.focusHistoryID ?? 0) + // 3. Within same category, sort by focus history + // Lower focusHistoryID = more recently focused = higher in stack + return (winB?.focusHistoryID ?? 0) - (winA?.focusHistoryID ?? 0) }) } } -- 2.51.2