Skip to content

Instantly share code, notes, and snippets.

@thekoc
Created January 8, 2017 15:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thekoc/3957a77a5488e8b3a0ae8ca01d4e4838 to your computer and use it in GitHub Desktop.
Save thekoc/3957a77a5488e8b3a0ae8ca01d4e4838 to your computer and use it in GitHub Desktop.
function callAlfred()
if (hs.window.focusedWindow():application():name() ~= "Alfred 3") then
hs.osascript.applescript('tell application "Alfred 3" to search')
hs.keycodes.setLayout("ABC")
else
hs.eventtap.keyStroke({}, "escape")
end
end
hs.hotkey.bind({"alt"}, "space", callAlfred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment