10

I have tried to set my default browser for opening URLs to Chromium using:

xdg-settings set default-web-browser chromium.desktop

(yes I checked out whether /usr/share/applications/chromium.desktop existed first before running this command and it does exist) and it returns:

xdg-settings: unknown desktop environment

i3 isn't a desktop environment so I can definitely understand this error, but is there a way around it? The reason I want xdg-open to open URLs using Chromium is that running notebook() from the SageMath command-line attempts to open the notebook in one's default web browser (using xdg-open). Presently this obviously fails (no browser, or application for that matter, is opened to the URL), so I'd like to get this to work which I believe will require me to get xdg-open to open URLs in Chromium.

2 Answers 2

3

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.

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .