-- 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()