Set the default browser on Linux
https://forum.manjaro.org/t/91211
LICENSE | ||
README.md | ||
set-browser.sh |
utility-set-browser.sh
Setting web browser script
Copy the file to your local bin folder and make sure it is executable (you may need to create the bin folder beforehand)
mkdir -p ~/.local/bin
chmod +x ~/.local/bin/set-browser.sh
The script requires you to know the desktop file name for the browser in question - run the script without argument to get a list of available browser launchers.
You can find the correct name by searching the folder /usr/share/applications
as this example shows.
The command searches the file contents for the string internet which indicates a browser applications, pipes the result through cut and print only the last column. Then use the appropriate file as argument for the script.
$ grep -rl 'internet' /usr/share/applications | cut -d'/' -f5
org.midori_browser.Midori.desktop
microsoft-edge-dev.desktop
firefox-developer-edition.desktop
vivaldi-stable.desktop
firefox.desktop
To set the browser run the script like this
set-browser.sh microsoft-edge-dev.desktop
Source: https://root.nix.dk/en/utility-scripts/set-browser-script