nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
5.59k stars 88 forks source link

Feature Request: Add Support for 3-Finger Touchpad Gesture to Navigate Active Spaces #448

Open joeonit opened 3 weeks ago

joeonit commented 3 weeks ago

Please add support for using the 3-finger touchpad gesture to navigate through active spaces. This would make it easier for users who are mainly reading or viewing content, allowing seamless space switching without relying on keyboard shortcuts. Thank you!

hwamil commented 2 weeks ago

https://nikitabobko.github.io/AeroSpace/goodness#use-trackpad-gestures-to-switch-workspaces

joeonit commented 2 weeks ago

https://nikitabobko.github.io/AeroSpace/goodness#use-trackpad-gestures-to-switch-workspaces

Isn’t there any workaround for this, as BetterTouchTool is a paid product?

jakenvac commented 2 weeks ago

You can research other tools to create custom trackpad gestures. Here's one such tool, however it's also a paid product.

https://multitouch.app/

I would recommend paying for tools that provide value to you.

It's a lot more work, but you could also do this with hammerspoon. Looks like there's a package for hammerspoon to make swipe detection much easier: https://github.com/mogenson/Swipe.spoon

jakenvac commented 2 weeks ago

@joeonit Here's a working hammerspoon script, using the 'swipe.spoon' module from my previous comment. It works great - it's a four finger swipe to change workspaces.

You can change it to a 3 (or n) finger swipe by changing the first argument to Swipe:start. Make sure you disable this gesture in the macos trackpad settings to avoid conflicts.

Swipe = hs.loadSpoon("Swipe")

local AEROSPACE = "/opt/homebrew/bin/aerospace"

function aerospaceExec(cmd)
  os.execute("nohup " .. AEROSPACE .. " " .. cmd .. " &")
end

-- use four finger swipe to switch workspace
local current_id, threshold
Swipe:start(4, function(direction, distance, id)
  if id == current_id then
    if distance > threshold then
      threshold = math.huge -- only trigger once per swipe
      if direction == "left" then
        aerospaceExec("workspace --wrap-around prev")
      elseif direction == "right" then
        aerospaceExec("workspace --wrap-around next")
      end
    end
  else
    current_id = id
    threshold = 0.1 -- swipe distance > 10% of trackpad
  end
end)

I'll submit a PR to add this to the goodness page later.