1

I have Ubuntu 20.04 LTS installed with default GNOME Shell.

Then I have created symlink for some application on the ~/Desktop folder with

ln -s /usr/bin/xclock ~/Desktop/xclock

(the xclock is just an example, it is ELF binary executable)

Now it looks like shown below:

xclock symlink

Clicking on this file does nothing, the execution bit is already set. There is no "Mark as Trusted" in the drop-down menu.

How can I launch this symlink while avoiding creating special .desktop-file for its linked executable?

1

You probably can't until the Gnome Shell Desktop Icons is developed to allow for directly running executables (which, probably, they shouldn't, but that is another discussion and a matter of opinion ;)). You will need to stick to a .desktop file for now.

1

I have found solution myself - we need to create special proxy .desktop file launcher and then select it in Open With as default application.

Warning: be careful with the ELF or symlink which you are trying to launch this way. It may harm your system if you got it from untrusted third-party.

Steps to be done:

  1. Create .desktop file to provide new file-association for ELF binaries:

    mkdir -p ~/.local/share/applications
    cat << EOF > ~/.local/share/applications/exec.desktop
    [Desktop Entry]
    Name=Run binary executable
    Exec=sh -c %f
    Terminal=false
    Type=Application
    EOF
    
  2. Select this application as default launcher - select Open with Other Application and set this newly created Run binary executable as default launcher.

  3. Double click on just created symlink to launch linked executable.

Notes:

  1. this is a universal fix for GNOME Shell, Unity, Cinnamon, Xfce, and MATE (on 18.04 LTS and newer).
  2. this fix also work for ELF files copied to the Desktop or any location managed by Nautilus (even from Nautilus itself).
  • I think a disadvantage is that we can't use any option an ELF-executable may provide. The example xclock would always run with default options. BTW you should find an entry to the default application in ~/.config/mimeapps.list. – mook765 May 8 '20 at 18:47
  • Will update answer about Xfce soon. So we need new association for application/x-executable, right? I'm not yet familiar with mimeapps.list, if you have experience with it - the answer will be welcomed :) – N0rbert May 8 '20 at 18:54
  • I checked - the "Open with Other Application" have written application/x-sharedlib=exec.desktop into ~/.config/mimeapps.list as expected. The default was empty. – N0rbert May 8 '20 at 19:07
  • Yes, that's how it works. – mook765 May 8 '20 at 19:08
  • Thank you for reminder :) – N0rbert May 8 '20 at 19:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.