Created
November 2, 2022 07:47
-
-
Save kiinoda/1b1460c4929864881fdf2f8bdeb1e104 to your computer and use it in GitHub Desktop.
Hammerspoon - press space+left_click on key press (used in Photoshop)
This file contains 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 characters
hs.hotkey.bind({"cmd", "ctrl", "alt", "shift"}, "f2", | |
-- next function is called on hotkey press | |
function() | |
hs.eventtap.event.newKeyEvent({}, "space", true):post() | |
hs.eventtap.event.newMouseEvent(hs.eventtap.event.types["leftMouseDown"], hs.mouse.absolutePosition()):post() | |
end, | |
function() | |
-- next function is called on hotkey release | |
hs.eventtap.event.newKeyEvent({}, "space", false):post() | |
hs.eventtap.event.newMouseEvent(hs.eventtap.event.types["leftMouseUp"], hs.mouse.absolutePosition()):post() | |
end | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment