How to setup default browser?

7,055

Solution 1

I'm assuming you want to change the default application opened for URLs
The easy way to change this is using gnome-control-center info and changing the default application.

Yes, the schema type is

x-scheme-handler/http=
x-scheme-handler/https=

each followed by the application.desktop you want to open http

Here is a sample mimeapps.list with chromium as the http app

Solution 2

Using xdg-utils:

xdg-settings set default-web-browser brave-beta-bin.desktop

If you don't know the desktop file associated with your favourite browser, then use mimeo:

➜ mimeo --app2desk brave-beta        
brave-beta
  brave-beta-bin.desktop

In this case, I am using the beta version of the brave browser, so I specified the command used to start the browser, and mimeo is able to find the associated desktop file.

Testing

➜ mimeo --mime2desk x-scheme-handler/http 
x-scheme-handler/http
  brave-beta-bin.desktop

➜ mimeo --mime2desk x-scheme-handler/https
x-scheme-handler/https
  brave-beta-bin.desktop

➜ xdg-open https://google.com         

~ via ⬢ v13.10.1 
➜ Opening in existing browser session.
Share:
7,055

Related videos on Youtube

Grzegorz Wierzowiecki
Author by

Grzegorz Wierzowiecki

Updated on September 18, 2022

Comments

  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki almost 2 years

    How to change default browser for opening url-s ?

    For sanity check, I tried:

    xdg-open 'http://unix.stackexchange.com'
    

    And it opens in other browser. I found information about assigning applications to filetypes with xdg-mime default xpdf.desktop application/pdf . However I don't know how to apply this knowledge for url ? Does url have mimetype ?

  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    I've assigned firefox with xdg-mime default firefox.desktop 'x-scheme-handler/http'... resulting in : cat ~/.local/share/applications/defaults.list = [Default Applications] x-scheme-handler/https=firefox.desktop x-scheme-handler/http=firefox.desktop , however it is still assigned to chrome when I run xdg-open 'http://unix.stackexchange.com'
  • bsd
    bsd over 12 years
    I had the exact same experience with the xdg-settings and xdg-mime default, even restarting the desktop, logging out/in didn't have the desired effect. But gnome-control-center info succeeded in changing from chromium to firefox and back again. xdg-open uses specified default.
  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    Thanks ! In my case I needed to run KDE Control Center with systemsettings