Skip to content

Instantly share code, notes, and snippets.

@huytd
Created December 13, 2021 18: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 huytd/20f98ecb2bf1d76b4de9f6c21f5fb37c to your computer and use it in GitHub Desktop.
Save huytd/20f98ecb2bf1d76b4de9f6c21f5fb37c to your computer and use it in GitHub Desktop.
Media control with Hammerspoon
-- Alt + ] = Next song
hs.hotkey.bind({"alt"}, "]", function()
hs.eventtap.event.newSystemKeyEvent('NEXT', true):post()
hs.eventtap.event.newSystemKeyEvent('NEXT', false):post()
end)
-- Alt + [ = Prev song
hs.hotkey.bind({"alt"}, "[", function()
hs.eventtap.event.newSystemKeyEvent('PREVIOUS', true):post()
hs.eventtap.event.newSystemKeyEvent('PREVIOUS', false):post()
end)
-- Alt + \ = Play / Pause
hs.hotkey.bind({"alt"}, "\\", function()
hs.eventtap.event.newSystemKeyEvent('PLAY', true):post()
hs.eventtap.event.newSystemKeyEvent('PLAY', false):post()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment