7

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 ?

7

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

| improve this answer | |
  • 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' – Grzegorz Wierzowiecki Feb 10 '12 at 12:12
  • 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. – bsd Feb 10 '12 at 13:32
  • Thanks ! In my case I needed to run KDE Control Center with systemsettings – Grzegorz Wierzowiecki Feb 10 '12 at 14:21
0

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.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.