diff --git a/mac-manual/content/06-keyboard.md b/mac-manual/content/06-keyboard.md index 7e75bd832c1..d742ccb57ce 100644 --- a/mac-manual/content/06-keyboard.md +++ b/mac-manual/content/06-keyboard.md @@ -31,7 +31,7 @@ On Macs with an ambient light sensor, the keyboard backlight follows the room: l The built-in trackpad scrolls naturally, as in macOS, and tap-to-click is off, because a palm brushing the trackpad while typing would otherwise click. Click by pressing the trackpad. Change either in `~/.config/hypr/input.lua`, as [Keyboard, mouse, trackpad](https://omarchy.org/manual/keyboard-mouse-trackpad/) describes; a value you set yourself is kept. -Swipe sideways with three fingers to move between workspaces, as in macOS. A three-finger sideways gesture of your own in `~/.config/hypr/input.lua` takes its place. To turn the swipe off, add this line to `~/.config/hypr/input.lua`: +Swipe sideways with three fingers to move between workspaces, as in macOS, including empty ones: swiping past the last workspace opens the next one. A three-finger sideways gesture of your own in `~/.config/hypr/input.lua` takes its place. To turn the swipe off, add this line to `~/.config/hypr/input.lua`: ```lua omarchy_workspace_gesture = false diff --git a/packages/omarchy-mac/share/omarchy/default/hypr/platform/apple-gestures.lua b/packages/omarchy-mac/share/omarchy/default/hypr/platform/apple-gestures.lua index 71b5e594e8d..0196dab4de2 100644 --- a/packages/omarchy-mac/share/omarchy/default/hypr/platform/apple-gestures.lua +++ b/packages/omarchy-mac/share/omarchy/default/hypr/platform/apple-gestures.lua @@ -25,4 +25,8 @@ for _, gesture in ipairs(o.registered_gestures or {}) do end end +-- Step by number, so the swipe reaches empty workspaces as Spaces do in macOS. +-- Hyprland's default steps only through workspaces that exist and never out of +-- an empty one into a new one. A user's own gesture keeps Hyprland's stepping. +hl.config({ gestures = { workspace_swipe_use_r = true } }) hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" }) diff --git a/test/shell.d/hyprland-apple-workspace-gesture-test.sh b/test/shell.d/hyprland-apple-workspace-gesture-test.sh index 9cd8d42d7b7..e07c06de6a3 100755 --- a/test/shell.d/hyprland-apple-workspace-gesture-test.sh +++ b/test/shell.d/hyprland-apple-workspace-gesture-test.sh @@ -79,6 +79,11 @@ end hl = setmetatable({ dsp = proxy(), + config = function(config) + if config.gestures and config.gestures.workspace_swipe_use_r ~= nil then + use_r = config.gestures.workspace_swipe_use_r + end + end, gesture = function(gesture) local direction = gesture.direction:lower() direction = aliases[direction] or direction @@ -110,6 +115,9 @@ hl = setmetatable({ }) dofile(os.getenv("HOME") .. "/.config/hypr/hyprland.lua") +if os.getenv("SHOW_USE_R") then + print("workspace_swipe_use_r " .. tostring(use_r == true)) +end LUA } @@ -157,6 +165,17 @@ output=$(load_config apple 'omarchy_workspace_gesture = false') [[ -z $output ]] || fail "omarchy_workspace_gesture = false turns the default off" "$output" pass "omarchy_workspace_gesture = false turns the default off" +[[ $(SHOW_USE_R=1 load_config apple) == "$swipe"$'\nworkspace_swipe_use_r true' ]] || + fail "a Mac swipe steps by number, into empty workspaces" "$(SHOW_USE_R=1 load_config apple)" +[[ $(SHOW_USE_R=1 load_config other) == "workspace_swipe_use_r false" ]] || + fail "x86 and Snapdragon keep Hyprland's own workspace stepping" "$(SHOW_USE_R=1 load_config other)" +output=$(SHOW_USE_R=1 load_config apple "$shipped_line") +[[ $output == "$swipe"$'\nworkspace_swipe_use_r false' ]] || + fail "a user's own workspace gesture keeps Hyprland's stepping" "$output" +output=$(SHOW_USE_R=1 load_config apple 'omarchy_workspace_gesture = false') +[[ $output == "workspace_swipe_use_r false" ]] || fail "turning the Mac gesture off keeps Hyprland's stepping" "$output" +pass "the Mac swipe steps into empty workspaces; a user's own gesture keeps Hyprland's stepping" + grep -Fq 'omarchy_workspace_gesture = false' "$ROOT/mac-manual/content/06-keyboard.md" || fail "the manual documents how to turn the Mac gesture off" pass "the manual documents how to turn the Mac gesture off"