Skip to content

Instantly share code, notes, and snippets.

@ghiden
Created July 21, 2018 01:27
Show Gist options
  • Save ghiden/5234a998632e0739b6aa7c268d49ce93 to your computer and use it in GitHub Desktop.
Save ghiden/5234a998632e0739b6aa7c268d49ce93 to your computer and use it in GitHub Desktop.
Because github pages cannot open a bookmarklet from firefox, I can't bookmark pages to pinboard. So I've created this Hammerspoon script to open a firefox page on safari.
getUrl = [[
tell application "System Events"
tell application "Firefox" to activate
delay .5
tell application "System Events"
keystroke "l" using command down
keystroke "c" using command down
end tell
delay .5
set u to the clipboard
tell application "Safari"
tell window 1
set current tab to (make new tab with properties {URL:u})
end tell
end tell
tell application "Safari" to activate
return u
end tell
]]
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Y", function()
ok,result = hs.applescript(getUrl)
hs.alert.show(result)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment