Created
February 2, 2017 14:27
-
-
Save jshbrntt/efa9caeb79521437524973d683c96063 to your computer and use it in GitHub Desktop.
Hammerspoon - Bind Scroll Wheel Left/Right to Ctrl+Left/Right (move spaces)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doKeyStroke = function(modifiers, character) | |
local event = require("hs.eventtap").event | |
event.newKeyEvent(modifiers, string.lower(character), true):post() | |
event.newKeyEvent(modifiers, string.lower(character), false):post() | |
end | |
hs.eventtap.new({hs.eventtap.event.types.scrollWheel}, function(e) | |
scrollWheelClick = e:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis2) | |
if scrollWheelClick > 0 then | |
doKeyStroke({'ctrl'}, 'left') | |
elseif scrollWheelClick < 0 then | |
doKeyStroke({'ctrl'}, 'right') | |
end | |
end):start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment