diff --git a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml index 6bc4339d..c6f8c60b 100644 --- a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml +++ b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml @@ -649,6 +649,16 @@ Item { anchors.fill: parent acceptedButtons: Qt.RightButton + property real scrollAccumulator: 0 + property real touchpadThreshold: 500 + property bool scrollInProgress: false + + Timer { + id: scrollCooldown + interval: 100 + onTriggered: parent.scrollInProgress = false + } + onClicked: mouse => { if (mouse.button === Qt.RightButton) { if (CompositorService.isNiri) { @@ -658,6 +668,30 @@ Item { } } } + + onWheel: wheel => { + if (scrollInProgress) + return; + + const delta = wheel.angleDelta.y; + const isMouseWheel = Math.abs(delta) >= 120 && (Math.abs(delta) % 120) === 0; + const direction = delta < 0 ? 1 : -1; + + if (isMouseWheel) { + root.switchWorkspace(direction); + scrollInProgress = true; + scrollCooldown.restart(); + } else { + scrollAccumulator += delta; + if (Math.abs(scrollAccumulator) >= touchpadThreshold) { + const touchDirection = scrollAccumulator < 0 ? 1 : -1; + root.switchWorkspace(touchDirection); + scrollInProgress = true; + scrollCooldown.restart(); + scrollAccumulator = 0; + } + } + } } Flow {