mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
@@ -224,12 +224,28 @@ Item {
|
|||||||
|
|
||||||
const currentIndex = realWorkspaces.findIndex(ws => ws === root.currentWorkspace)
|
const currentIndex = realWorkspaces.findIndex(ws => ws === root.currentWorkspace)
|
||||||
const validIndex = currentIndex === -1 ? 0 : currentIndex
|
const validIndex = currentIndex === -1 ? 0 : currentIndex
|
||||||
const nextIndex = direction > 0 ? (validIndex + 1) % realWorkspaces.length : (validIndex - 1 + realWorkspaces.length) % realWorkspaces.length
|
const nextIndex = direction > 0 ? Math.min(validIndex + 1, realWorkspaces.length - 1) : Math.max(validIndex - 1, 0)
|
||||||
|
|
||||||
|
if (nextIndex === validIndex) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
NiriService.switchToWorkspace(realWorkspaces[nextIndex] - 1)
|
NiriService.switchToWorkspace(realWorkspaces[nextIndex] - 1)
|
||||||
} else if (CompositorService.isHyprland) {
|
} else if (CompositorService.isHyprland) {
|
||||||
const command = direction > 0 ? "workspace r+1" : "workspace r-1"
|
const realWorkspaces = getRealWorkspaces()
|
||||||
Hyprland.dispatch(command)
|
if (realWorkspaces.length < 2) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentIndex = realWorkspaces.findIndex(ws => ws.id === root.currentWorkspace)
|
||||||
|
const validIndex = currentIndex === -1 ? 0 : currentIndex
|
||||||
|
const nextIndex = direction > 0 ? Math.min(validIndex + 1, realWorkspaces.length - 1) : Math.max(validIndex - 1, 0)
|
||||||
|
|
||||||
|
if (nextIndex === validIndex) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Hyprland.dispatch(`workspace ${realWorkspaces[nextIndex].id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user