mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(workspace): 'Previous workspace doesn't exist' warning on hyprland single workspace
This commit is contained in:
+3
-1
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user