Alpha Chen 11 months ago
parent 34f1f7c3c1
commit d0d5fea302
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -54,21 +54,20 @@
(with-selection #(.. "[" $1 "]" "(" $2 ")")))]]) (with-selection #(.. "[" $1 "]" "(" $2 ")")))]])
;; cmd-shift-c: copy current url ;; cmd-shift-c: copy current url
(let [safari-applescript "tell application \"Safari\" to get URL of front document" (let [{: activated : deactivated} application.watcher
copy-safari (hotkey.new [:cmd :shift] :c firefox (hotkey.new [:cmd :shift] :c #(eventtap.keyStrokes :yy))
#(let [(_ obj _) (osascript.applescript safari-applescript)] safari-applescript "tell application \"Safari\" to get URL of front document"
(pasteboard.setContents obj))) safari (hotkey.new [:cmd :shift] :c
copy-firefox (hotkey.new [:cmd :shift] :c #(eventtap.keyStrokes :yy)) #(let [(_ obj _) (osascript.applescript safari-applescript)]
{: activated : deactivated} application.watcher (pasteboard.setContents obj)))
update-hotkey (fn [name event app] per-app {"Firefox Developer Edition" firefox :Safari safari}
(match [name event] update-app (fn [name event _app]
["Firefox Developer Edition" activated] (copy-firefox:enable) (match [(. per-app name) event]
["Firefox Developer Edition" deactivated] (copy-firefox:disable) [app-config activated] (app-config:enable)
[:Safari activated] (copy-safari:enable) [app-config deactivated] (app-config:disable)))
[:Safari deactivated] (copy-safari:disable))) watcher (application.watcher.new update-app)]
watcher (application.watcher.new update-hotkey)]
;; hold onto watcher as a global so it doesn't get GC'ed ;; hold onto watcher as a global so it doesn't get GC'ed
(set _G.watcher (watcher:start))) (set _G.per-app-watcher (watcher:start)))
;;; Elgato Key Light Air ;;; Elgato Key Light Air

Loading…
Cancel
Save