Ubuntu – Shell script not opening as desktop application

desktopexecutablescriptsubuntu-dockwine

I have a shell script which is a wine command to open an .exe file, which looks like this:

#!/bin/bash
wine wow.exe -opengl

Its only purpose is to run that .exe file. It works if I just double click the script. The location of the script is the same as the .exe file. What I want is to have a desktop application, i.e. an icon I can pin to my dock, which executes this shell script. My desktop application file looks like this:

[Desktop Entry]
Comment=WoW
Exec=/home/siegmeyer/Documents/WoW/WoW.sh
Icon=/home/siegmeyer/Documents/WoW/WoW.png
Terminal=false
Type=Application
StartupNotify=false
Name[en_US]=WoW

I can successfully pin the application to my dock, the icon even shows up, but when I click the application, nothing happens, the cursor gets stuck into an infinite loading icon. Have I missed anything?

Best Answer

To make sure the script is looking for the executable in the right directory, you could change the call to

wine "$(realpath "$(dirname "$0")")/wow.exe" -opengl

This will insert the absolute path of the script (and thus the exe) into the call. It would work without the quotes for paths that don't contain whitespace, but I recommend to keep them in case you move the directory.