Xdg-open doesn't open hyperlinks in web browser

Since a couple of updates, xdg-open doesn’t seem to work properly anymore. Or people could argue it works (too well?). Let me explain, before when I was clicking a hyperlink from an application, it would always open it in the web browser, but since a couple of updates at least, it now open the link in other programs depending on what it detects the target of the link to be. Quick example:

xdg-open https://imgur.com/7t27GZu will open the web browser

xdg-open https://i.imgur.com/7t27GZu.jpg will open the image in Gwenview

I’m pretty confident this was not the behavior let say a month ago (or maybe a little more, I noticed it recently).

Can people confirm that it is not normal behavior and that it also does the same on their side?
I had other weird behavior like links trying to open in Kate, the same as it tries to open links in Gwenview, depending on what xdg-open thinks is appropriate (can’t find the links that produced that anymore, this was when I tried to troubleshoot it when It occurred for the first time at least a month ago, didn’t even have made the connection with xdg-open back then).

Yes this isn’t the normal behavior. For me both the links open in default web browser only. You can refer to this reddit post for a similar issue and arch wiki. This should fix the issue and open the both the links in the given browser:

xdg-settings set default-web-browser chromium.desktop
xdg-mime default chromium.desktop x-scheme-handler/https x-scheme-handler/http

Change chromium to anything else you want :wink:

1 Like

Nice thanks! The first command was apparently enough in my case to fix the issue. This is weird as in theory Firefox was already my default browser, but setting it through xdg-settings set default-web-browser firefox.desktop command fixed the issue.


1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.