From deac0ba7b2a8f67ac91320d512cd478ade2446eb Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 11 Oct 2022 20:42:53 -0700 Subject: [PATCH] hammerspoon --- .hammerspoon/init.fnl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.hammerspoon/init.fnl b/.hammerspoon/init.fnl index b3b81bc..2b7039d 100644 --- a/.hammerspoon/init.fnl +++ b/.hammerspoon/init.fnl @@ -67,17 +67,20 @@ (url:find "^https://.*[.]bulletin.com/") (open-url :safari) (string.find orig-url "^https://doi.org/") ((open-with :firefox) (.. "https://sci-hub.st/" orig-url)) + (string.find orig-url "^https://.*[.]usps.com/") + ((open-with :firefox) orig-url) (open-url :firefox)))) (set hs.urlevent.httpCallback (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") redirect (partial run "curl -Ls -o /dev/null -w %{url_effective}") orig-url (de-utm url) redirected (de-utm (redirect orig-url))] (handle redirected orig-url)))) - ; (hs.urlevent.openURLWithBundle orig-url bundle-ids.firefox)))) + +; (hs.urlevent.openURLWithBundle orig-url bundle-ids.firefox)))) ;;; Spoons