Brave

From Bitpost wiki
Revision as of 20:47, 4 December 2023 by M (talk | contribs) (→‎Settings)

Configure

Settings

Immediately change these Settings on any new profile:

  • Get started > Profile name and icon > customize it!
  • Get started > New Tab Page > shows > Homepage
  • Appearance > Toolbar > Show home button ON, set to bitpost.com
  • Appearance > Brave Rewards, Brave Wallet > OFF
  • Appearance > (very bottom) Cycle through the most recently used tabs with Ctrl-Tab
  • Sync > I have a chain > paste, toggle Sync everything ON

Profiles

Profiles in Brave are AWESOME:

  • Brave seems to remember what desktop the windows were on!!! FINALLY
  • For each profile, you get a name and customizable icon in the top-right of the toolbar, SO NICE
  • Bookmarks etc. are all profile-specific, as expected
  • You can sync a profile across machines (see #Sync)

Finding Profile folder

You can start brave with a specific profile, like this:

brave-browser --profile-directory='Profile 4'&

This is a bit dicey as the folder you must provide does not actually match the profile name! I used this bit of ugliness to get a map of name to folder:

 💉 m@cast  [~/.config/BraveSoftware/Brave-Browser] grep -Po "\"name\":\"[^\"]*?\",\"(pa|usi)" * -R
Default/Preferences:"name":"moodboom","pa
Profile 4/Preferences:"name":"es-1","pa
Profile 5/Preferences:"name":"mdmdev-1","pa
Profile 6/Preferences:"name":"Profile 2","pa
Profile 7/Preferences:"name":"ig-1","usi

Assign VSCode Launch to (re)use a Brave profile

When vscode starts its Javascript debugger, it uses a custom "user-data-dir" within its own config folder. This means you start with a clean profile upon first use. However, (after MUCH trial-and-horror), you can specify that it uses a precise profile within this custom user-data-dir.

If you use a launch.json stanza like this, vscode will always use that specific profile. You can then start customizing the profile, and your changes will stick across debugging sessions. Awesome!

 "configurations": [
   {
     "name": "Launch Brave",
     "runtimeExecutable": "/usr/bin/brave-browser",
     // NOTE: This directory will be within .code/Code/User; specifying it allows reuse of a specific Profile there, nice.
     "runtimeArgs": [ "--profile-directory=\"Profile 4\"" ],
     "type": "chrome",
     "request": "launch",
     "timeout": 5000,
     "url": "http://localhost:8008",
     "webRoot": "${workspaceFolder}/src"
   }
 ]

That should be all you need to get usage of a consistent profile across sessions. But... say you want to sync it across development environments... why not! Read on...

More Details

Again, we dig to get a map of profile names to folders. First, run the debugger, and look for the process and params:

ps ax|grep -Po brave.*config/Code/User/workspaceStorage/.*?profile

From that, you can extract a user-data-dir:

--user-data-dir=/home/m/development/config/common/home/m/.config/Code/User/workspaceStorage/436f0a4c50203656e625d634df9e0ca9/ms-vscode.js-debug/.profile

NOTE that it seems that each vscode project has its own workspaceStorage! Which is pretty crazy. That means every dev project can have its own set of profiles.

From the user-data-dir folder, you can get a map of profile name to folder:

cd #your-user-data-dir#
grep -Po "\"name\":\"[^\"]*?\",\"(pa|usi)" * -R
   "Profile 4"/Preferences:"name":"es-2","usi

Now that you know what is where.... Just like with "normal" profiles, you can sync them across machines.

Set up sync

Do this for each profile:

  • Settings > Sync > Start a new Sync Chain > Computer > copy Sync Chain Code > save in private
  • Make sure Sync everything is toggled ON
  • You can now paste this chain into another computer to sync this profile there

Install

Copy and paste this all in one shot!

sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install brave-browser