Skip to content

Instantly share code, notes, and snippets.

@kirillrogovoy
Last active June 14, 2021 05:43
Show Gist options
  • Save kirillrogovoy/b74804b5763afa8c907826c866eb989f to your computer and use it in GitHub Desktop.
Save kirillrogovoy/b74804b5763afa8c907826c866eb989f to your computer and use it in GitHub Desktop.

How to open all links in Incognito by default.

  1. Open Script Editor
  2. Create a new file and paste the code below
  3. Save it as /Applications/BrowserProxy.app
  4. Open the terminal and try opening a website with the new script: open -a /Applications/BrowserProxy.app https://google.com
  5. Install https://github.com/kerma/defaultbrowser and run defaultbrowser browserproxy to set the new script as the default browser
  6. Try clicking any links in external apps other than the browser itself and see them open in new Incognito tabs.

NOTE: I'm using Brave Browser as the target browser. You should change it to what suits your needs. Since Brave is a Chromium, changing every "Brave Browser" to "Google Chrome" should suffice.

Script code:

on open location this_URL
	do shell script "\"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser\" --profile-directory=Default --incognito \"" & this_URL & "\""
end open location

You can introduce any depth of complexity here, or delegate the logic to a script written in your language of choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment