Created
January 10, 2020 21:46
-
-
Save yspreen/373dd691977eb85bb1d493878797c43c to your computer and use it in GitHub Desktop.
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
do_cut = false | |
fc = function() | |
hkc:disable() | |
if hs.window.focusedWindow():application():bundleID() == "com.apple.finder" then | |
hs.eventtap.keyStroke({"cmd"}, "C") | |
do_cut = false | |
else | |
hs.eventtap.keyStroke({"cmd"}, "C") | |
end | |
hkc:enable() | |
end | |
fx = function() | |
hkc:disable() | |
hkx:disable() | |
if hs.window.focusedWindow():application():bundleID() == "com.apple.finder" then | |
hs.eventtap.keyStroke({"cmd"}, "C") | |
do_cut = true | |
else | |
hs.eventtap.keyStroke({"cmd"}, "X") | |
end | |
hkc:enable() | |
hkx:enable() | |
end | |
fv = function() | |
hkv:disable() | |
if hs.window.focusedWindow():application():bundleID() == "com.apple.finder" then | |
if do_cut then | |
hs.eventtap.keyStroke({"cmd", "alt"}, "V") | |
else | |
hs.eventtap.keyStroke({"cmd"}, "V") | |
end | |
do_cut = false | |
else | |
hs.eventtap.keyStroke({"cmd"}, "V") | |
end | |
hkv:enable() | |
end | |
hkc = hs.hotkey.new({"cmd"}, "C", fc) | |
hkc:enable() | |
hkx = hs.hotkey.new({"cmd"}, "X", fx) | |
hkx:enable() | |
hkv = hs.hotkey.new({"cmd"}, "V", fv) | |
hkv:enable() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment