Using Brave Browser flags in linux

Posted on Sun 23 August 2020 in dev-journal

The easiest solution to add flags to your Brave Browser startup is to use the brave AUR package. It has a brave-launcher script that will check for a .config/brave-flags.conf file. All you need to do is create and populate the .config/brave-flags.conf

Alternative if using the brave-bin package

If you are running arch linux and have installed the brave-bin package from the AUR, one solution is to copy what the AUR brave package has done to solve the issue. Create a brave-launcher file in somewhere where your terminal will know it exists. Then edit the usr/share/applications/brave-browser.desktop to launch brave-launcher instead of brave.

brave-launcher

1
2
3
4
5
6
7
8
9
#!/bin/sh

XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
BRAVE_USER_FLAGS_FILE="$XDG_CONFIG_HOME/brave-flags.conf"
if [[ -f $BRAVE_USER_FLAGS_FILE ]]; then
    USER_FLAGS="$(cat $BRAVE_USER_FLAGS_FILE | sed 's/#.*//')"
fi

/usr/bin/brave $@ $USER_FLAGS

usr/share/applications/brave-browser.desktop

...
Exec=brave-launcher %U
Terminal=false
Icon=brave
...