1

I've already tried the other answers to this question with no success. I'm using Ubuntu 16.04. I'm just trying to create some custom actions for Terminator, but I've decided to go back to basics and see if I can get something to work. Here's what I've tried:

  1. Copied and pasted the example desktop entry file from https://standards.freedesktop.org/desktop-entry-spec/latest/apa.html into a file called $HOME/foo.desktop
  2. Ran desktop-file-validate $HOME/foo.desktop. No output.
  3. Ran desktop-file-install --dir=$HOME/.local/share/applications $HOME/foo.desktop
  4. chmod 755 $HOME/.local/share/applications/foo.desktop
  5. Logged out and back in again.

The new launcher does not appear. What am I missing? Is there some log that would explain why the desktop file does not appear?

1 Answers1

1

This is the example desktop entry file:

[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
Actions=Gallery;Create;

[Desktop Action Gallery] Exec=fooview --gallery Name=Browse Gallery

[Desktop Action Create] Exec=fooview --create-new Name=Create a new Foo! Icon=fooview-new

https://specifications.freedesktop.org/desktop-entry-spec/latest/apa.html

Note the TryExec=fooview field. Here is what the desktop entry standard says:

TryExec

Path to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $PATH environment variable. If the file is not present or if it is not executable, the entry may be ignored (not be used in menus, for example).

We note that fooview is not an absolute path, so let's see if it's in $PATH:

$ type -P fooview
$ type -a fooview
bash: type: fooview: not found

Here's another way to test this:

$ gtk-launch foo.desktop
gtk-launch: no such application foo.desktop

Compare with e.g. gtk-launch eog.desktop.

Since there is no fooview executable, this means that "the entry may be ignored (not be used in menus, for example)", which is why Unity is not showing it in the menus; it thinks the application has not been installed.

To fix this, you must replace the TryExec key with either an absolute path or an executable somewhere in $PATH.

Related: