fix(workspaces): assign display index per output in ExtWorkspaceService

This commit is contained in:
Lysec
2026-03-30 15:20:57 +02:00
parent c879d0864b
commit 6d3ca58896
+16 -3
View File
@@ -93,7 +93,10 @@ Item {
workspaces.clear();
nativeWorkspaceMap = {};
let idx = 1;
/* Per-output (projection) index: compositors expose one workspace group per
* monitor with names "1"…"9". A single global idx produced 1018 on the
* second head because all windowsets were merged into one list. */
const perOutputNextIdx = {};
for (const ws of nativeWs) {
if (!ws.shouldDisplay) {
@@ -108,6 +111,18 @@ Item {
}
}
const groupKey = outputName || "_";
let idx;
const numericName = ws.name && /^\d+$/.test(String(ws.name)) ? parseInt(ws.name, 10) : NaN;
if (!isNaN(numericName) && numericName >= 1) {
idx = numericName;
} else {
if (perOutputNextIdx[groupKey] === undefined) {
perOutputNextIdx[groupKey] = 1;
}
idx = perOutputNextIdx[groupKey]++;
}
const wsEntry = {
"id": ws.id || idx.toString(),
"idx": idx,
@@ -122,8 +137,6 @@ Item {
workspaces.append(wsEntry);
nativeWorkspaceMap[wsEntry.id] = ws;
idx++;
}
updateWindowWorkspaces();