3

I'm trying to create an application launcher for a program (unigine heaven), I've created a .desktop file which looks like this:

[Desktop Entry]
Version=1.0
Name=Unigine Heaven 4.0
Type=Application
Icon=heaven-icon.png
Exec=/home/**redacted**/Unigine_Heaven-4.0/heaven
Terminal=true

I've made the file executable, and tried to run it, and nothing happens. If i go into terminal inside /home/**redacted**/Unigine_Heaven-4.0/ and run ./heaven, everything works as it should, I just can't get that terminal command to work within a .desktop file. Any ideas?

Edit: formatting for clarity

1
  • 1
    Can you try this Exec=sh -c "cd /home/**redacted**/Unigine_Heaven-4.0; ./heaven" ?
    – Liso
    Oct 22, 2017 at 6:52

1 Answer 1

2

If we examine the executable script heaven we shall see the paths inside are relative:

#!/bin/bash

cd ./bin
ARCH=$(uname -m)
if [ "$ARCH" == x86_64 ]; then
    export LD_LIBRARY_PATH=./x64:$LD_LIBRARY_PATH
    ./browser_x64 -config ../data/launcher/launcher.xml
else
    export LD_LIBRARY_PATH=./x86:$LD_LIBRARY_PATH
    ./browser_x86 -config ../data/launcher/launcher.xml
fi

So the solution is to add working directory (Path key) to the launcher (the .desktop file):

[Desktop Entry]
Version=1.0
Name=Unigine Heaven 4.0
Type=Application
Icon=heaven-icon.png
Path=/home/<user>/Unigine_Heaven-4.0
Exec=/home/<user>/Unigine_Heaven-4.0/heaven
Terminal=false
  • Replace /home/<user>/Unigine_Heaven-4.0 with the actual path in use.
  • Please note also this change: Terminal=false.

  • The solution provided by @Sans also works:

    Exec=sh -c "cd /home/<user>/Unigine_Heaven-4.0/heaven; ./heaven"
    

References:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .