xdg-open only opens a new tab in a new Chromium window despite passing it a URL

Solution 1:

The issue is indeed that xdg-open does not pass the requested URL to Chromium, so instead of running chromium-browser url-here, it is executing chromium-browser which just opens a new window.

After searching on the Internet, I found out that xdg-open uses some "config" files located in /usr/share/applications.

/usr/share/applications/chromium-browser.desktop seemed to be correct, as it is configured to pass the URL to Chromium correctly:

$ grep Exec /usr/share/applications/chromium-browser.desktop
Exec=chromium-browser %U
...

So what was wrong? It turns out that there's another location which xdg-open uses and that has priority over /usr/share/applications.

$ grep Exec ~/.local/share/applications/chromium-browser.desktop
Exec=/usr/lib/chromium-browser/chromium-browser --use-system-title-bar --ppapi-flash-path=/usr/lib/pepflashplugin-installer/libpepflashplayer.so --ppapi-flash-version=14.0.0.125

I have no idea as to why there's another chromium-browser.desktop, but note that this Exec line does not pass the URL; it is missing the %U. So I simply appended %U to this line. This instantly fixed all issues with xdg-open and Chromium.