Last active
June 2, 2020 14:29
-
-
Save jellea/95fbff7e8fd820b78f18250d57ace1b9 to your computer and use it in GitHub Desktop.
Revisions
-
jellea revised this gist
Oct 30, 2018 . No changes.There are no files selected for viewing
-
jellea revised this gist
Oct 30, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ defaultBrowser = "org.mozilla.Firefox" --Remove hypens below to set other browser as a default --defaultBrowser = "com.google.Chrome" --defaultBrowser = "com.apple.Safari" -
jellea revised this gist
Oct 30, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" --defaultBrowser = "com.apple.Safari" defaultBrowserName = string.match(defaultBrowser, '%a+$') hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall -
jellea revised this gist
Oct 27, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,6 @@ function openUrl(appBundleID,url,choice) -- Workaround: Notion share links can contain the company name, which the desktop app can't open. elseif string.find(url, "notion.so/") then url = string.gsub(url, "/pitch", "") end hs.application.launchOrFocusByBundleID(appBundleID) -
jellea revised this gist
Oct 26, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Install=spoon.SpoonInstall function openUrl(appBundleID,url,choice) if choice==defaultBrowserName then appBundleID = defaultBrowser -- Workaround: Notion share links can contain the company name, which the desktop app can't open. elseif string.find(url, "notion.so/") then url = string.gsub(url, "/pitch", "") hs.alert.show(url) @@ -20,7 +20,7 @@ function openUrl(appBundleID,url,choice) hs.urlevent.openURLWithBundle(url, appBundleID) end function webOrDesktop(appBundleID,appName,url) openFn = hs.fnutils.partial(openUrl, appBundleID, url) mousePos = hs.mouse.getAbsolutePosition() hs.dialog.alert(mousePos.x,mousePos.y,openFn,"How to open this "..appName.." link?", "", appName.." App", defaultBrowserName) -
jellea revised this gist
Oct 26, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Install=spoon.SpoonInstall function openUrl(appBundleID,url,choice) if choice==defaultBrowserName then appBundleID = defaultBrowser -- Workaround: Notion share links could contain the company name, which the desktop app can't open. elseif string.find(url, "notion.so/") then url = string.gsub(url, "/pitch", "") hs.alert.show(url) -
jellea revised this gist
Oct 26, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,11 @@ Install=spoon.SpoonInstall function openUrl(appBundleID,url,choice) if choice==defaultBrowserName then appBundleID = defaultBrowser elseif string.find(url, "notion.so/") then url = string.gsub(url, "/pitch", "") hs.alert.show(url) end hs.application.launchOrFocusByBundleID(appBundleID) hs.urlevent.openURLWithBundle(url, appBundleID) end -
jellea revised this gist
Oct 25, 2018 . No changes.There are no files selected for viewing
-
jellea renamed this gist
Oct 25, 2018 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,9 @@ 2. Install [SpoonInstall](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpoonInstall.spoon.zip) (unzip and click to install) 3. Move the contents of `appOrWebDialog.lua` (question dialog version) or `alwaysApp.lua` (default to app version) to `~/.hammerspoon/init.lua` 4. Reload Hammerspoon configuration if you already started it. 5. Set Hammerspoon as default web browser in macOS preferences -> General # Add more apps 1. Figure out the App Bundle Identifier. Right click "Show Package Contents" on Application and open `Contents/Info.plist` inside. Find the Bundle Identifier in the plist file. 2. Add a new line to `url_patterns`: `{ "https?://www.website.com", nil, hs.fnutils.partial(webOrDesktop, "Bundle Identifier here", "App name here") },` 3. Reload Hammerspoon configuration -
jellea revised this gist
Oct 25, 2018 . 3 changed files with 2 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,3 @@ # Install 1. Install [Hammerspoon](http://www.hammerspoon.org/) 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" --defaultBrowser = "com.apple.Safari" hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" --defaultBrowser = "com.apple.Safari" defaultBrowserName = "Firefox" hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall -
jellea revised this gist
Oct 25, 2018 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,14 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" defaultBrowserName = "Firefox" hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall function openUrl(appBundleID,url,choice) if choice==defaultBrowserName then appBundleID = defaultBrowser end hs.application.launchOrFocusByBundleID(appBundleID) @@ -14,7 +17,8 @@ end function webOrDesktop (appBundleID,appName,url) openFn = hs.fnutils.partial(openUrl, appBundleID, url) mousePos = hs.mouse.getAbsolutePosition() hs.dialog.alert(mousePos.x,mousePos.y,openFn,"How to open this "..appName.." link?", "", appName.." App", defaultBrowserName) end Install:andUse("URLDispatcher", -
jellea revised this gist
Oct 24, 2018 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,10 @@ # Motivation Some (web) apps don't give you the choice to open their urls on the web or in their app. This small script allows you to setup up urls to be opened with specific apps and adds a question if web or desktop is desired. # Install 1. Install [Hammerspoon](http://www.hammerspoon.org/) 2. Install [SpoonInstall](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpoonInstall.spoon.zip) (unzip and click to install) 3. Move the contents of `appOrWebDialog.lua` (question dialog version) or `alwaysApp.lua` (default to app version) to `~/.hammerspoon/init.lua` 4. Reload Hammerspoon configuration if you already started it. 5. Set Hammerspoon as default web browser in macOS preferences -> General -
jellea created this gist
Oct 24, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # Install 1. Install [Hammerspoon](http://www.hammerspoon.org/) 2. Install [SpoonInstall](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpoonInstall.spoon.zip) (unzip and click to install) 3. Move the contents of `alwaysApp.lua` or `appOrWebDialog.lua` to `~/.hammerspoon/init.lua` 4. Set Hammerspoon as default web browser in macOS preferences -> General 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall Install:andUse("URLDispatcher", { config = { url_patterns = { { "https?://www.figma.com", "com.figma.Desktop" }, { "https?://www.notion.so", "notion.id" }, }, default_handler = defaultBrowser }, start = true } ) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ defaultBrowser = "org.mozilla.Firefox" --defaultBrowser = "com.google.Chrome" hs.loadSpoon("SpoonInstall") Install=spoon.SpoonInstall function openUrl(appBundleID,url,choice) if choice=="Browser" then appBundleID = defaultBrowser end hs.application.launchOrFocusByBundleID(appBundleID) hs.urlevent.openURLWithBundle(url, appBundleID) end function webOrDesktop (appBundleID,appName,url) openFn = hs.fnutils.partial(openUrl, appBundleID, url) hs.dialog.alert(100,100,openFn,"How would you like to open this "..appName.." link?", "", "Desktop App", "Browser") end Install:andUse("URLDispatcher", { config = { url_patterns = { { "https?://www.figma.com", nil, hs.fnutils.partial(webOrDesktop, "com.figma.Desktop", "Figma") }, { "https?://www.notion.so", nil, hs.fnutils.partial(webOrDesktop, "notion.id", "Notion")}, }, default_handler = defaultBrowser }, start = true } )