Changing default programs

Personal Log 2020-01-02

The default web browser that came installed for my Raspberry Pi (Raspberry Pi OS) was Chromium. I wanted to change the default web browser to Firefox.

Install Firefox

Install Firefox (sudo apt install firefox-esr). I chose the Extended Support Release (ESR) option (from apt-cache search firefox).

See what information is available

Use the update-alternatives command to see what is currently being used as the default web browser. For example:

🖥 update-alternatives --get-selections | grep -i chromium
📟 gnome-www-browser  auto /usr/bin/chromium-browser
📟 x-www-browser      auto /usr/bin/chromium-browser

From update-alternatives --help, the --display and --config flags are also useful.

--display <name>   display information about the <name> group.
--config <name>    show alternatives for the <name> group and ask the user to select which one to use.

I was surprised to find another browser on my system called dillo.

🖥 update-alternatives --display x-www-browser
📟 x-www-browser - auto mode
   link best version is /usr/bin/chromium-browser
   link currently points to /usr/bin/chromium-browser
   link x-www-browser is /usr/bin/x-www-browser
   slave x-www-browser.1.gz is /usr/share/man/man1/x-www-browser.1.gz
📟 /usr/bin/chromium-browser - priority 90
📟 /usr/bin/dillo - priority 50
   slave x-www-browser.1.gz: /usr/share/man/man1/dillo.1.gz
📟 /usr/bin/firefox-esr - priority 70
   slave x-www-browser.1.gz: /usr/share/man/man1/firefox-esr.1.gz
The dillo web browser.

Change the default browser

I set Firefox as the default for both x-www-browser and gnome-www-browser. Note that sudo is required for these operations.

🖥 sudo update-alternatives --config x-www-browser
📟 There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).
📟 Selection    Path                       Priority   Status
------------------------------------------------------------
 * 0            /usr/bin/chromium-browser   90        auto mode 
   1            /usr/bin/chromium-browser   90        manual mode 
   2            /usr/bin/dillo              50        manual mode 
   3            /usr/bin/firefox-esr        70        manual mode 
🖥 Press <enter> to keep the current choice[*], or type selection number: 3
📟 update-alternatives: using /usr/bin/firefox-esr to provide /usr/bin/x-www-browser (x-www-browser) in manual mode
🖥 sudo update-alternatives --config gnome-www-browser
📟 There are 2 choices for the alternative gnome-www-browser (providing /usr/bin/gnome-www-browser).
📟 Selection    Path                       Priority   Status 
------------------------------------------------------------ 
* 0            /usr/bin/chromium-browser   90        auto mode 
  1            /usr/bin/chromium-browser   90        manual mode 
  2            /usr/bin/firefox-esr        70        manual mode 
🖥 Press to keep the current choice[*], or type selection number: 2
📟 update-alternatives: using /usr/bin/firefox-esr to provide /usr/bin/gnome-www-browser (gnome-www-browser) in manual mode

tl;dr

Install the program that you wish to set as default, find the name for the type of program (e.g. x-www-browser), and use the update-alternatives --config <name> command to select it as the default.