xdg-open only opens a new tab in a new Chromium window despite passing it a URL
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.
Related videos on Youtube
Comments
-
Léo Lam almost 2 years
When I am using
xdg-open
to open a link in Chromium, it just results in a new Chromium window with only the new tab page, with nothing else.For example,
xdg-open 'https://askubuntu.com'
will just open a new Chromium window and won't open up AskUbuntu.It just seems that the URL isn't being passed to Chromium, as invoking Chromium directly does work and opens the desired page:
chromium-browser 'https://askubuntu.com'
works.Obviously, Chromium is the default browser.
Where could the problem be, and how can I fix that? It is especially annoying when some programs use
xdg-open
to open a link and you can't go to the page you want, or even see what was opened.-
Admin over 9 yearsAlthough this question is for Chromium, this might work for Firefox if it is the same issue.
-
-
Adaline Simonian over 8 yearsIncredible! I've been beating my head against a brick wall for weeks on this one, barely found this answer. Same thing happens with the
google-chrome
package. How did you figure it out? -
Léo Lam over 8 yearsUltimately, I think that the issue was caused by pepperflash, although I'm not sure. Need to look at the package file list or install script to be sure.
-
Vlad over 8 yearsThanks, worked for google-chrome by updating ~/.local/share/applications/google-chrome.desktop
-
Íhor Mé over 7 yearsMoved chrome-related files from /.local/share/applications and it started working instantly! Thanks!