I have the following scenario: Ubuntu 16.04 machine with firefox and chrome installed, chrome being my default browser.
I check this actions in the shell :
To set a default browser, make sure that a .desktop
file exists for your preferred browser. I'll be setting Mozilla Iceweasel for this example:
$ ls /usr/share/applications/iceweasel.desktop
iceweasel.desktop
Assured you have the file, run:
$ xdg-settings set default-web-browser iceweasel.desktop
# Test that it works
$ xdg-open "http://example.com"
I use the program surf
, which doesn't have a .desktop file. To set this as your web browser, first create the file ~/.local/share/applications/surf.desktop
with this following content:
[Desktop Entry]
Type=Application
Name=surf
Comment=Surf minimal web browser
Terminal=false
Exec=surf
Categories=Network;WebBrowser
While not all of this content is required, it helps categorize the file for any future use.
Set the default browser like normal:
$ xdg-settings set default-web-browser surf.desktop
And now you're good to go!