Brave: Difference between revisions

From Bitpost wiki
Line 17: Line 17:


==== Finding Profile folder ====
==== Finding Profile folder ====
This is a bit dicey as it does not actually match the profile name!  I used this bit of ugliness to get a map of name to 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
   💉 m@cast  [~/.config/BraveSoftware/Brave-Browser] grep -Po "\"name\":\"[^\"]*?\",\"(pa|usi)" * -R
Line 25: Line 27:
  Profile 6/Preferences:"name":"Profile 2","pa
  Profile 6/Preferences:"name":"Profile 2","pa
  Profile 7/Preferences:"name":"ig-1","usi
  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"
    }
  ]
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
From that, get a map:
cd #your-user-data-dir#
grep -Po "\"name\":\"[^\"]*?\",\"(pa|usi)" * -R
    "Profile 4"/Preferences:"name":"es-2","usi


=== Set up sync ===
=== Set up sync ===

Revision as of 15:16, 28 November 2023

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
  • Brave Rewards > Show Brave Rewards in bar OFF
  • 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"
   }
 ]

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

From that, get a map:

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

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