dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

swipe.lua (729B)


      1 -- use three finger swipe to focus nearby window
      2 local key = hs.eventtap.keyStroke
      3 local current_id, threshold
      4 Swipe = hs.loadSpoon("Swipe")
      5 Swipe:start(3, function(direction, distance, id)
      6   if id == current_id then
      7     if distance > threshold then
      8       threshold = math.huge -- only trigger once per swipe
      9 
     10       -- use "natural" scrolling
     11       if direction == "left" then
     12         key({ "ctrl", "shift" }, "tab")
     13       elseif direction == "right" then
     14         key({ "ctrl" }, "tab")
     15       elseif direction == "up" then
     16         key({ "cmd" }, "t")
     17       elseif direction == "down" then
     18         key({ "cmd" }, "w")
     19       end
     20     end
     21   else
     22     current_id = id
     23     threshold = 0.2 -- swipe distance > 10% of trackpad
     24   end
     25 end)