I basically have the same question that was answered over here:
Except I am running on Ubuntu 14.04 and am interested in customizing the command line arguments passed to the browser. Is there a way to do this?
Programs use a variety of other programs to determine the default browser
xdg-open being two of them.
xdg-open, you can use it simply by by running
xdg-open http://URL, so
xdg-open https://www.google.co.uk will open Google for instance.
This should be the same as running
echo https://www.google.co.uk in terminal and clicking on the link should open the default browser (in my case, Firefox).
You can see what is the default browser using
xdg-settings get default-web-browser:
$ xdg-settings get default-web-browser firefox.desktop
To set values, you do
xdg-settings set default-web-browser LAUNCHER-FILE.desktop:
$ xdg-settings set default-web-browser chromium-browser.desktop
So now running
echo https://www.google.co.uk and clicking on the link or running
xdg-open https://www.google.co.uk should open Google in the new default browser (in my case now chromium).
Notice that it links to the program's .desktop file not it's command - this needs to be a valid file in
~/.local/share/applications). You can create your own with a custom command easily by copying a existing one and changing the 'Name' and 'Exec' lines:
$ cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox-new-window.desktop $ gedit ~/.local/share/applications/firefox-new-window.desktop & disown ##Then change Name and Exec lines to `Name=Firefox (New Window)` & `Exec=firefox --new-window %u` respectively $ update-desktop-database ~/.local/share/applications/ $ xdg-settings set default-web-browser firefox-new-window.desktop
In the above I created a new launcher, edited it so it would launch a new window firefox, update the database of launcher files and set it to default. Now running
xdg-open https://www.google.co.uk opens a new window of Firefox.