fix(workspace): 'Previous workspace doesn't exist' warning on hyprland single workspace

This commit is contained in:
tibssy
2026-02-18 19:02:07 +00:00
parent 948c3f2e72
commit 927edbaebe
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -306,7 +306,7 @@ Item {
candidates.push(ws);
}
if (candidates.length === 0)
if (candidates.length <= 1)
return;
var current = -1;
@@ -329,6 +329,8 @@ Item {
return;
}
if (next === current)
return;
CompositorService.switchToWorkspace(candidates[next]);
}
+3 -1
View File
@@ -196,7 +196,7 @@ Item {
}
function switchByOffset(offset) {
if (localWorkspaces.count === 0)
if (localWorkspaces.count <= 1)
return;
var current = getFocusedLocalIndex();
if (current < 0)
@@ -204,6 +204,8 @@ Item {
var next = (current + offset) % localWorkspaces.count;
if (next < 0)
next = localWorkspaces.count - 1;
if (next === current)
return;
const ws = localWorkspaces.get(next);
if (ws && ws.idx !== undefined)
CompositorService.switchToWorkspace(ws);