0

Changed some names to be more accurate.

I have an app that I can run from terminal. The app exists in a folder in my home directory named ZereneStacker. The name of the app is also ZereneStacker. Right now, I only know how to run it from terminal and I do that like this.

cd ZereneStacker
./ZereneStacker.bsh

It runs fine this way.

I created a .desktop file in /usr/share/applications and named it zerene.desktop. I made it executable. Here is the contents of zerene.desktop:

[Desktop Entry]
Version=1.0
Name=Zerene Focus Stacker
Comment=Focus Stacker
GenericName=Focus Stacker
Exec=./ZereneStacker.bsh
Path=~/ZereneStacker
Terminal=false
Type=Application
Categories=Photography
StartupNotify=true

I stole most of this from another working .desktop file. When I try and click on the icon in /usr/share/applications, I get "There was an error launching this application". Since I know it loads fine when I do it form the terminal command line as outlined above, I know the problem is with what I did and not the program.

Sorry I tried to be generic in the original message to "simplify" only to have that backfire on me now.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • I tried the method in the above thread and It seemed to leave out just enough info not to work for me. I created the desktop file in /usr/shared/applications as directed, but now what. It does not get this into the target directory (MyApps). If I browse to the applications folder and click on the icon, I get "there was an error launching the application" with no further info. I looked at the file, and I don't see an issue. – Charlie RC Aug 01 '16 at 23:35
  • Could you please [edit] your question and post the content of the .desktop file you made? Also you meant /usr/share/applications right? Not shared? – Zanna Aug 02 '16 at 04:57
  • Message modified (and corrected) above. – Charlie RC Aug 02 '16 at 23:41
  • 1
    Bad assumption: Desktop files aren't shell scripts. Replace Exec=./ZereneStacker.bsh and Path=~/ZereneStacker with absolute paths. – waltinator Aug 03 '16 at 02:42
  • @waltinator: The path of the program in the Exec entry is relative to the Path entry. Path=/home/user/ZereneStacker and Exec=./ZereneStacker.bsh should be fine. – David Foerster Aug 03 '16 at 09:51

1 Answers1

1

The Path key of a Desktop Entry File doesn't perform tilde expansion or any other form of shell expansion. You need to specify an absolute path that will be interpreted verbatim until the next line break character, e. g.:

Path=/home/charlie/ZereneStacker

This is probably what you want because the application directory is only in your home directory, not in every user's home directory. For the same reason it may also make more sense to put the desktop entry file in ~/.local/share/applications because that's where user-specific desktop entries reside (instead of the system-wide locations /usr/share/applications and /usr/local/share/applications).

Alternatively you can remove the Path key of invoke a shell from the Exec key of and have it expand the tilde:

Exec=/bin/sh -c "cd ~/ZereneStacker && exec ./ZereneStacker.bsh"
David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • Thank you very much, all! Turns out that the only thing I could get to work was what you suggested, David, with the Exec=/bin/sh. I would still love to figure out what I was dong wrong with the other method, but at least this gets me to the point I ulimately wanted to be at. – Charlie RC Aug 03 '16 at 15:44