komorebi icon indicating copy to clipboard operation
komorebi copied to clipboard

.desktop files open as text files

Open RicardoEPRodrigues opened this issue 7 years ago • 7 comments

Hello, thank you for this amazing app.

I love the added desktop icons support, yet I find it annoying when I try to open .desktop files (aka shortcuts) and it opens them on a text file, instead of opening the app itself.

RicardoEPRodrigues avatar Sep 08 '17 14:09 RicardoEPRodrigues

Yes. That sucks. Especially since I have quite a few application (some of the commercial - like PDF Studio), who only place a .desktop file to ~/Desktop to start the program. Now I have to open the command line in order to be able to start them... Komorebi 2.0 on Ubuntu 16.04,

mjeltsch avatar Sep 17 '17 14:09 mjeltsch

Seems like the culprit line is https://github.com/cheesecakeufo/komorebi/blob/994725d147674bf7fe9392ccc1460cc41df1f8fb/src/OnScreen/Icon.vala#L176.

I'm guessing that, as it opens using the @"file:// suffix, since .desktop files are text files anyways, it defaults to the text editor.

$ xdg-mime query filetype ~/Desktop/MyLauncher.desktop
application/x-desktop

Sadly I haven't found a suitable URI for launching applications in the URI schemes list:

https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml


Perhaps the code is reaching for xdg-open or something similar underneath to open the files. Opening the files through xdg-open has the same effect, according to this ancient bug.

https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/378783

resolritter avatar Oct 31 '18 23:10 resolritter

I was able to fix the issue! It seems like indeed Komorebi is calling to xdg-open underneath.


STEP 1. Verify that your xdg-mime is correctly detecting the desktop launcher file as an application.

$ xdg-mime query filetype ~/Desktop/Launcher.desktop
application/x-desktop

STEP 2. Install dex, as suggested by Stu-axon here.

STEP 3. Register dex as the default application for the application/x-desktop mimetype following this short guide: https://superuser.com/a/309343.

For step 3 I created a file on ~/.local/share/applications/dex.desktop with the following contents:

[Desktop Entry]
Name=Dex
Exec=dex %u
Type=Application
Terminal=false
MimeType=application/x-desktop

STEP 4. Final step, verify that your application/x-desktop is correctly bound to the file you created on STEP 3.

$ xdg-mime query default application/x-desktop
dex.desktop

Now clicking the desktop files on Komorebi correctly open them through Dex, which launches the application.

@cheesecakeufo Do you want me to include this solution in the repo's information?

resolritter avatar Oct 31 '18 23:10 resolritter

I have tried the dex workaround with no luck, the desktops files still open with Mousepad and I have followed the instructions correctly. I've also verified how does it opens through xdg-open and surprisingly they open as normal applications even withouth dex (probably because it's handled by panel-desktop-handler.desktop)

Debian 9 Strecth with Xfce 4.12

EDIT: Apparently Xfce seems to handle filetype associations differently, I've managed to change from Mousepad to it's default value, Create a Launcher, through the MIME type editor bundled with Xfce. Still Testing...

EDIT2: panel-desktop-handler.desktop is actually create a launcher, might try the Dex solution again.

EDIT3: Can confirm that the dex solution works withouth the need to create a desktop file, just go to the MIME type editor, find application/x-desktop and change it to select application, go to the custom order and type dex then click Open or Ok (In my case was Open).

Though, Trash still doesn't work as it doesn't open.

TheSandBoxMKG avatar Nov 30 '18 03:11 TheSandBoxMKG

same issue, dex workarround dont work form me

chupilococo avatar Mar 29 '19 15:03 chupilococo

I was able to fix the issue! It seems like indeed Komorebi is calling to xdg-open underneath.

STEP 1. Verify that your xdg-mime is correctly detecting the desktop launcher file as an application.

$ xdg-mime query filetype ~/Desktop/Launcher.desktop
application/x-desktop

STEP 2. Install dex, as suggested by Stu-axon here.

STEP 3. Register dex as the default application for the application/x-desktop mimetype following this short guide: https://superuser.com/a/309343.

For step 3 I created a file on ~/.local/share/applications/dex.desktop with the following contents:

[Desktop Entry]
Name=Dex
Exec=dex %u
Type=Application
Terminal=false
MimeType=application/x-desktop

STEP 4. Final step, verify that your application/x-desktop is correctly bound to the file you created on STEP 3.

$ xdg-mime query default application/x-desktop
dex.desktop

Now clicking the desktop files on Komorebi correctly open them through Dex, which launches the application.

@cheesecakeufo Do you want me to include this solution in the repo's information?

======== It works, thanks. Deepin-Linux-15.11(based on Ubuntu).

Steps:

$ sudo apt install dex
# create a file(Do the same as you do): ~/.local/share/applications/dex.desktop
$ xdg-mime query default application/x-desktop
deepin-editor.desktop
$ xdg-mime default dex.desktop application/x-desktop
$ xdg-mime query default application/x-desktop
dex.desktop

yanjingtu avatar Jul 14 '20 14:07 yanjingtu

Sorry to necro this, but the same exact issue is happening with .AppImage files on the desktop. They are properly marked as executable, double-clicking them works on the normal desktop, komorebi tries to open them in a text editor.

joker-119 avatar Jun 14 '21 17:06 joker-119