My xdg html default looks like this:

$ xdg-mime query default text/html

The Exec line in opera.desktop looks like this:

Exec=opera %U

Now, opening a tab in Opera like this:

opera "http://google.com"

Works perfectly, and opens a single tab, but if I do this:

xdg-open "http://google.com"

It opens the tab, but additionally opens 2 more tabs with "http://opera/" in the address field. It's basically equivalent to running:

opera "http://google.com" opera opera

I would expect that the xdg-open invocation would work exactly like the opera one. How come it doesn't?

Here's the whole opera.desktop file, unchanged from install:

[Desktop Entry]
GenericName=Web browser
Comment=Fast and secure web browser
Exec=opera %U

[Desktop Action NewWindow]
Name=New Window
Exec=opera --new-window

[Desktop Action NewPrivateWindow]
Name=New Private Window
Exec=opera --private
  • I couldn't reproduce this issue with latest version of Opera on Linux. Something must be different on your machine. Have you tried to reset preferences or reinstalling Opera instead? – user109256 Sep 21 '16 at 18:18
  • Are there hidden characters on the Exec=opera %U line? Are there other opera processes still running? If you change to Exec=opera -newwindow %U does it still show the multiple tabs? How does it fair if you delete the Actions line? – strobelight Sep 23 '16 at 21:32
  • @strobelight There are no fishy hidden characters. I checked by using :set list in vim. I tried adding -newwindow and commenting out the Actions line, but nothing changed. I changed the file /usr/share/applications/opera.desktop. How can I make sure that's the file that's being used by xdg-open? – Hubro Sep 26 '16 at 11:35
  • 1
    @strobelight Ah, I just commented out both the action blocks at the bottom of the file, and that solved it. I assume that's what you meant, and not just the single line starting with Actions. So how come both action blocks are run when I use xdg-open? :S – Hubro Sep 26 '16 at 11:37
  • Well the action blocks shouldn't have been run until you right-clicked on the icon and chose one. If you don't need those actions, and that solved your problem, just leave them out. Something else to try if you want them is preceded the Actions line with a blank line, delete its trailing semicolon, otherwise, you may have to update. – strobelight Sep 26 '16 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.