xdg-open *.desktop opens text editor

Bug #378783 reported by typo
564
This bug affects 127 people
Affects Status Importance Assigned to Milestone
GLib
Fix Released
Unknown
gvfs
New
Undecided
Unassigned
glib2.0 (Ubuntu)
Fix Committed
Low
Unassigned

Bug Description

Binary package hint: xdg-utils

In order to reproduce it execute "xdg-open *.desktop" (choose any .desktop file, e.g. one from /usr/share/applications). Actually your favorite text editor will open the file. Expected result: It'll be executed.

Because of this bug, desktop entries with the new "#!/usr/bin/env xdg-open" shebang feature were opened in the text editor when executed from command line.

Tags: bionic
Revision history for this message
SF007 (sf007) wrote :

I can confirm this, however, "exo-open" and "kde-open" still work...

Revision history for this message
ronny (ronny-standtke) wrote :

I can also confirm this bug. I need to test the opening of applications via xdg-open because of http://bugs.winehq.org/show_bug.cgi?id=19702
Unfortunately, this bug prevents testing of the wine bug above...

Changed in xdg-utils (Ubuntu):
status: New → Confirmed
Revision history for this message
Tyler Wagner (tyler) wrote :

Can we please give this bug some importance. Until this is fixed, there is NO WAY, short of grep+exec trickery, to execute .desktop files from the command line.

Revision history for this message
Alex Solanos (hakermania) wrote :

I confirm!

Revision history for this message
James (jamesasgrim) wrote :

Also confirm, but I tried kde-open and this also opened the .desktop file in my text editor.

This affects me because I'm trying to run an application from command line that is also in my Unity bar but from the command line, but for some reason it launches as a separate icon instead of putting an arrow next to the existing icon.

Revision history for this message
Colin Law (colin-law) wrote :

Can we get the priority of this boosted as it also means that desktop files that are selected from the Unity Dash are opened in gedit instead of being run. See bug #975427 Dash opens desktop files in gedit instead of running them

telinit (telinit)
no longer affects: xdg-utils (Gentoo Linux)
Revision history for this message
Tom Wieczorek (twz123) wrote :

Same behavior for gnome-open: It just launches the text editor. Are there any bug reports for gnome-open / kde-open concerning this issue?

Revision history for this message
ronny (ronny-standtke) wrote :

I just noticed that "kioclient exec <desktop file>" executes desktop files just fine. So at least for KDE users there is finally a solution for this issue.
I would prefer a standard (desktop agnostic) solution though.

Revision history for this message
MestreLion (mestrelion) wrote :

@Tom #7: gnome-open was deprecated a long time ago, xdg-open now uses gvfs-open. Upstream bug report is https://bugzilla.gnome.org/show_bug.cgi?id=343896

affects: xdg-utils (Ubuntu) → gvfs (Ubuntu)
Changed in gvfs:
importance: Unknown → Low
status: Unknown → Confirmed
Revision history for this message
Albert Zeyer (albertzeyer) wrote :

kde-open also opens in a file editor for me. This is quite annoying.

Revision history for this message
Jarno Suni (jarnos) wrote :

xdg-open works as expected in Ubuntu (Studio) 14.04.

Revision history for this message
pqwoerituytrueiwoq (pqwoerituytrueiwoq) wrote :

xdg-open works as expected in Xubuntu 14.04

Revision history for this message
Mikhail Yevchenko (mikhail-yevchenko) wrote :

xdg-open and exo-open opens a text editor in Ubuntu 14.10.

Revision history for this message
Jonathan (desertshadow) wrote :

Ubuntu 15, xdg-open still opens a text editor. Let's get this fixed, it's been 3 years

Changed in gvfs (Ubuntu):
assignee: nobody → Florian LE MINOUX (fodoc22)
assignee: Florian LE MINOUX (fodoc22) → nobody
Revision history for this message
Seb Bonnard (sebma) wrote :

Hi, xdg-open opens a kate in Ubuntu 14.10.

Can anyone tell me the output of this command on Ubuntu 14.04 so I can compare it to my Ubuntu 14.10 :

xdg-mime query default application/x-desktop

Revision history for this message
skierpage (skierpage) wrote :

re: comment #15

In Kubuntu 16.04, xdg-open is a bash script that determines your desktop environment (starting with the value of $XDG_CURRENT_DESKTOP) and calls the file opener for that desktop. For XFCE that appears to be exo-open. So run exo-open in debug mode to see what's going on.

> xdg-mime query default application/x-desktop

This outputs "wine-extension-txt.desktop" in my Kubuntu 16.04 desktop, so `xdg-open /path/to/some.desktop` grinds away and eventually starts Notepad in Wine! After I renamed $HOME/.local/share/applications/wine-extension-txt.desktop to ..._DISABLED, that command outputs "org.kde.kate.desktop" and so the file opens in the Kate editor.

As I understand it, our desktops don't have a .desktop file volunteering to handle the mime type application/x-desktop. The `/usr/share/mime/application/x-desktop.xml` file that associates the extension .desktop file with application/x-desktop also says it's <sub-class-of type="text/plain"/>, and that's why desktops end up running the application that handles text files.

Changed in gvfs:
status: Confirmed → Expired
Revision history for this message
Stu (stu-axon) wrote :

This is still a bug in December 2016.

Tested in Gnome on 16.04.

Commercial programmes and Wine programmes install .desktop files. And they just end up opening gedit.

I've noticed this bug for years but only reported it now.

Revision history for this message
Stu (stu-axon) wrote :

To fix:

Install dex:

$ sudo apt-get install dex

Download this desktop file https://gist.github.com/stuaxo/4169fc1342c496b7c8f7999188f2f242 -

$ wget https://gist.github.com/stuaxo/4169fc1342c496b7c8f7999188f2f242/raw/5c77265f3ea149107853637515f86afc95b2692a/dex.desktop -O ~/.local/share/applications/dex.desktop

Desktop files will now launch their apps instead of opening gedit.

Revision history for this message
marsteegh (marsteegh) wrote :

A very annoying bug, and *Still* not fixed.

Revision history for this message
Sviatoslav Sydorenko (webknjaz) wrote :

I'm also suffering from this bug, so here's some workarounds I've found on the Internet.

SO suggests the following workarounds:
* gtk-launch foo opens foo.desktop
* exo-open [[path-to-a-desktop-file]...]
* hashbang: #!/usr/bin/env deskopen
* dex foo.desktop

Ref:
https://askubuntu.com/questions/5172/running-a-desktop-file-in-the-terminal

Revision history for this message
Zaplo (zaplo) wrote :

What is preventing this from being fixed? Is it just lack of devs or because of stupid design decision?

Revision history for this message
Ra (raffamaiden) wrote :

Still bugged after 9 years from the reporting ....

Rolf Leggewie (r0lf)
tags: added: bionic
Changed in gvfs:
status: Expired → Confirmed
Revision history for this message
josvanr (josvanr) wrote :

Correction: the nineth anniversary of this bug is only now coming up soon:

ubuntu 18.04

xdg-open transmission-gtk.desktop

opens up a text editor instead of launching 'transmission'

It seems to work on xubuntu 17.10, though...

Revision history for this message
josvanr (josvanr) wrote :

now it would be nice to have a way of finding out when it does/doesn't work..

Changed in gvfs:
status: Confirmed → Expired
Revision history for this message
Stu (stu-axon) wrote :

Hi,
   This bug still exists in 18.04, and I imagine it still will in another 8 years.

S

Revision history for this message
Gert van den Berg (mohag1) wrote :

Upstream bug URL changed to https://gitlab.gnome.org/GNOME/glib/issues/54

Unable to edit it...

Revision history for this message
Gert van den Berg (mohag1) wrote :

Gnome bug was migrated to Gitlab (over at https://gitlab.gnome.org/GNOME/glib/issues/54 ) and the bug number changed as a result. Currently the close bug (due to being migrated) seems to result in it being set expired all the time.

Changed in gvfs:
importance: Low → Undecided
status: Expired → New
Revision history for this message
elichai2 (elichai2) wrote :

Hi,
This bug still exists In Kubuntu 18.04 KDE: 5.12.7

Thanks.

Revision history for this message
Flechette39 (flechette39) wrote :

This bug still exists on Ubuntu 18.10 Cosmic Cuttlefish, and it sucks so bad.
Hope those upstream guys get it fixed soon.

affects: gvfs (Ubuntu) → glib2.0 (Ubuntu)
Changed in glib2.0 (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Changed in glib:
status: Unknown → New
Revision history for this message
Andrew Keats (steakeye) wrote :

I was on Bionic Beaver and my '.desktop' Desktop Entry files were working but after an upgrade to Disco Dingo they just launch gedit.

Revision history for this message
xChris (cs-.) wrote :

Temp "patch" (works with gnome-shell)

install "dex" , then @ $HOME/.local/share/applications create
a file "userapp-dex.desktop" as:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=/usr/bin/dex %u
Name=Dex
Comment=Dex-opener

"asssociate" a .desktop file with that

Revision history for this message
Adeel Raza Azeemi (adeel-raza-azeemi) wrote :

Adding these two lines at the end of the .desktop file; makes it possible to show allow launching from right click and made the file actual executable shortcut

Type=Application
Terminal=0

Revision history for this message
Kenneth Hanson (khanson679) wrote :

Bug still present in Kubuntu 19.10.

Revision history for this message
whitefawn (whitefawn) wrote :

Confirmed #32 in 19.10
I added Terminal=0 . Then I right-clicked on the icon and selected "Allow Launching" from the menu. The launch worked, just as in Windows 3.1 Thanks Adeel!

Revision history for this message
Euclides Paim (euclidespaim) wrote :

Bug stlil present in Ubuntu 20.04.

Changed in glib:
status: New → Fix Released
Changed in glib2.0 (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
AvidSeeker (avidseeker) wrote :

The bug still affects Ubuntu 23.04:

Screenshot: https://i.imgur.com/QDFe6tQ.png

Submitted bug report to xdg-utils package: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/213

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.