How to set the default web browser used to open URLs under i3?

Install perl-file-mimeinfo and configure it that way. See the Arch Wiki article on xdg-utils:

If no desktop environment is detected, MIME type detection falls back to using file which—ironically—does not implement the XDG standard. If you want xdg-open to use XDG MIME Applications without a desktop environment, you will need to install perl-file-mimeinfo or switch to one of the resource openers that support XDG MIME Applications.


I set it in /usr/share/applications/defaults.list and it worked for me (opening links from the Slack app). Indeed, the list of available applications is /usr/share/applications/*.desktop

These lines had to be edited in my case:

text/html=firefox.desktop;
text/xml=firefox.desktop;
application/xhtml_xml=firefox.desktop;
image/webp=firefox.desktop;
x-scheme-handler/http=firefox.desktop;
x-scheme-handler/https=firefox.desktop;
x-scheme-handler/ftp=firefox.desktop;

This can probably also be done per-user in ~/.config/mimeapps.list

Tags:

Xdg Open

I3