Skip to content

Instantly share code, notes, and snippets.

@hosaka
Created May 18, 2023 05:03
Show Gist options
  • Save hosaka/bd889b596f25292e14c97d558ad6cff8 to your computer and use it in GitHub Desktop.
Save hosaka/bd889b596f25292e14c97d558ad6cff8 to your computer and use it in GitHub Desktop.
Brave browser installed via scoop with Windows default app associated opens links in an empty data dir

Setup

  1. Install brave with scoop.sh
scoop install brave
  1. Open Brave and set it as default from Settings->Set Brave as your default browser. You can also open settings with brave://settings/
  2. Open Windows settings, go to Apps->Default apps and click on Brave in the "Set defaults for applications" list. Click on "Set default" next to "Make Brave your default browser"

Problem

  1. Scoop keeps your Brave User Data folder under %USERPROFILE%\scoop\persist\brave\User Data\ instead of default %APPDATA%\Local\BraveSoftware\Brave-Browser\User Data\ when installing Brave system wide.
  2. Scoop creates a StartMenu shortcut for you that passes a --user-data-dir= to the executable to open the browser with a correct data dir
  3. This flag is not passed when setting Brave as your default browser app, causing Brave to create a new empty profile under %APPDATA% when handling user clicked links

Fix

  1. Need to pass the same --user-data-dir= flag to the command that starts the default browser
  2. Run the registry editor and navigate to Computer\HKEY_CURRENT_USER\Software\Classes\ and search for an entry starting with BraveHTML. In my case:
Computer\HKEY_CURRENT_USER\Software\Classes\BraveHTML.EZFHM3RMMULEVXSSUS2XFITXRI\shell\open\command
  1. Modify the value to include the correct User Data path.

From:

"C:\Users\USER\scoop\apps\brave\current\brave.exe" --single-argument %1

To:

"C:\Users\USER\scoop\apps\brave\current\brave.exe" --user-data-dir="C:\Users\USER\scoop\apps\brave\current\User Data" --single-argument %1
  1. Click on a link in any application rather than Brave itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment