hammerspoon

pull/2/head
Alpha Chen 2 years ago
parent c33fe4cd13
commit deac0ba7b2
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -67,16 +67,19 @@
(url:find "^https://.*[.]bulletin.com/") (open-url :safari) (url:find "^https://.*[.]bulletin.com/") (open-url :safari)
(string.find orig-url "^https://doi.org/") (string.find orig-url "^https://doi.org/")
((open-with :firefox) (.. "https://sci-hub.st/" orig-url)) ((open-with :firefox) (.. "https://sci-hub.st/" orig-url))
(string.find orig-url "^https://.*[.]usps.com/")
((open-with :firefox) orig-url)
(open-url :firefox)))) (open-url :firefox))))
(set hs.urlevent.httpCallback (set hs.urlevent.httpCallback
(fn [scheme host params url] (fn [scheme host params url]
(let [run #(: (io.popen (.. $1 " \"" $2 "\"")) :read :*a) (let [run #(: (io.popen (.. $1 " '" $2 "'")) :read :*a)
de-utm (partial run "~/.dotfiles/bin/de-utm") de-utm (partial run "~/.dotfiles/bin/de-utm")
redirect (partial run "curl -Ls -o /dev/null -w %{url_effective}") redirect (partial run "curl -Ls -o /dev/null -w %{url_effective}")
orig-url (de-utm url) orig-url (de-utm url)
redirected (de-utm (redirect orig-url))] redirected (de-utm (redirect orig-url))]
(handle redirected orig-url)))) (handle redirected orig-url))))
; (hs.urlevent.openURLWithBundle orig-url bundle-ids.firefox)))) ; (hs.urlevent.openURLWithBundle orig-url bundle-ids.firefox))))
;;; Spoons ;;; Spoons

Loading…
Cancel
Save