Created
January 5, 2021 18:29
-
-
Save jpf/e6a83f7c80eb1556144835b679d258c1 to your computer and use it in GitHub Desktop.
Hammerspoon code to do a "turret paste"
This file contains hidden or 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
popHopper = function() | |
return nil | |
end | |
turretPaste = function() | |
next = popHopper() | |
if next == nil then | |
-- this will result in no action after a keypress | |
clip = hs.pasteboard.readString() | |
popHopper = string.gmatch(clip, "[^%s]+") | |
else | |
hs.eventtap.keyStrokes(next) | |
end | |
end | |
-- Clear "turret" | |
hs.hotkey.bind('', 'f17', function() | |
popHopper = function() | |
return nil | |
end | |
end) | |
hs.hotkey.bind('', 'f18', function() | |
turretPaste() | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment