Skip to content

Instantly share code, notes, and snippets.

@megalithic
Forked from zzamboni/catch_fn.lua
Created June 1, 2017 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megalithic/6b15d29337d629f658b02c7a2ef92455 to your computer and use it in GitHub Desktop.
Save megalithic/6b15d29337d629f658b02c7a2ef92455 to your computer and use it in GitHub Desktop.
How to catch the fn key using Hammerspoon
-- Catch fn-h and convert it to a left arrow key.
function catcher(event)
if event:getFlags()['fn'] and event:getCharacters() == "h" then
print("fn-h!")
return true, {hs.eventtap.event.newKeyEvent({}, "left", true)}
end
return false
end
local tapper=hs.eventtap.new({hs.eventtap.event.types.keyDown}, catcher):start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment