Created
March 5, 2017 12:26
-
-
Save chrismytton/74fb2d15aaff656b5ffdd41ba95f1ec0 to your computer and use it in GitHub Desktop.
Revisions
-
chrismytton created this gist
Mar 5, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ -- Send escape when ctrl is tapped local send_escape = false local ctrl_pressed = false hs.eventtap.new({hs.eventtap.event.types.flagsChanged}, function(event) local flags = event:getFlags() if flags["ctrl"] then ctrl_pressed = true send_escape = true else if ctrl_pressed and send_escape then hs.eventtap.keyStroke({}, 'ESCAPE') end send_escape = false ctrl_pressed = false end return false end):start() hs.eventtap.new({hs.eventtap.event.types.keyDown}, function(event) send_escape = false return false end):start()