xdg-open *.desktop opens text editor

Bug #378783 reported by typo on 2009-05-20
This bug affects 126 people
Affects Status Importance Assigned to Milestone
Fix Released
glib2.0 (Ubuntu)

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.

SF007 (sf007) wrote :

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

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
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.

Alex Solanos (hakermania) wrote :

I confirm!

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.

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) on 2013-01-21
no longer affects: xdg-utils (Gentoo Linux)
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?

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.

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
Albert Zeyer (albertzeyer) wrote :

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

Jarno Suni (jarnos) wrote :

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

xdg-open works as expected in Xubuntu 14.04

Mikhail Yevchenko (mail-c) wrote :

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

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
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

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
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.

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.

marsteegh (marsteegh) wrote :

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

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


Zaplo (zaplo) wrote :

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

Ra (raffamaiden) wrote :

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

Rolf Leggewie (r0lf) on 2018-04-21
tags: added: bionic
Changed in gvfs:
status: Expired → Confirmed
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...

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
Stu (stu-axon) wrote :

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


Gert van den Berg (mohag1) wrote :

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

Unable to edit it...

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
elichai2 (elichai2) wrote :

This bug still exists In Kubuntu 18.04 KDE: 5.12.7


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
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.

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]
Exec=/usr/bin/dex %u

"asssociate" a .desktop file with that

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


Kenneth Hanson (khanson679) wrote :

Bug still present in Kubuntu 19.10.

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!

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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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