35

I'm on 15.04 64 bit Lubuntu and I downloaded chrome from their website, because it can be useful at times, but I want to keep firefox as my default browser and despite having put it as default browser it still doesn't run when I execute x-www-browser. I then manually put firefox as default using the update-alternatives script, but what made me wonder was why chrome put itself at a priority of 200. I don't regard chrome as high as they do themselves, so how would I be able to change the priorities?

This is what I have now and firefox did indeed become my default application, but it shouldn't have, when I clearly put it as default in the firefox interface itself.

  Selection    Path                           Priority   Status
------------------------------------------------------------
  0            /usr/bin/google-chrome-stable   200       auto mode
  1            /usr/bin/chromium-browser       40        manual mode
* 2            /usr/bin/firefox                40        manual mode
  3            /usr/bin/google-chrome-stable   200       manual mode
Peter Raeves
  • 1,109

3 Answers3

37

You can change the priority with:

sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser google-chrome-stable <priority_as_integer>

Example:

before

$ sudo update-alternatives --config x-www-browser 
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                         Priority   Status
------------------------------------------------------------
* 0            /usr/bin/google-chrome-beta   150       auto mode
  1            /usr/bin/firefox              150       manual mode
  2            /usr/bin/google-chrome-beta   150       manual mode

after:

$ sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/google-chrome-beta 50
update-alternatives: using /usr/bin/firefox to provide /usr/bin/x-www-browser (x-www-browser) in auto mode

$ sudo update-alternatives --config x-www-browser                                                        
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                         Priority   Status
------------------------------------------------------------
* 0            /usr/bin/firefox              150       auto mode
  1            /usr/bin/firefox              150       manual mode
  2            /usr/bin/google-chrome-beta   50        manual mode
A.B.
  • 92,125
16

In short: edit /var/lib/dpkg/alternatives/x-www-browser and change priority inside


DETAILS

An easiest and the must answer is to edit the administrative update-alternative files found in the /var/lib/dpkg/alternatives

So edit the x-www-browser file

sudo gedit /var/lib/dpkg/alternatives/x-www-browser

The output will be like this:

auto
/usr/bin/x-www-browser

/usr/bin/firefox
40
/usr/bin/google-chrome-stable
200
/usr/bin/vivaldi-stable
200

Now easily change the priority of chrome (200) by whatever you want then save. (I changed to 50)

check the new settings

update-alternatives --query x-www-browser 
Link: x-www-browser
Status: auto
Best: /usr/bin/vivaldi-stable
Value: /usr/bin/google-chrome-stable

Alternative: /usr/bin/firefox
Priority: 40

Alternative: /usr/bin/google-chrome-stable
Priority: 50

Alternative: /usr/bin/vivaldi-stable
Priority: 200
Maythux
  • 87,123
0

I have qutebrowser installed to ~/.local/bin which is on my $PATH. I had put the full path to the executable, meaning I had to run

sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser $HOME/.local/bin/qutebrowser 200

instead of using qutebrowser only as second-to-last argument (because update-alternatives complained about the path not being absolute) then

update-alternatives --config x-www-browser

EDIT: I'm on debian buster/sid, HTH anyways. EDIT2: Reasoning why I had to specify the full path to qutebrowser.

pylipp
  • 1