Ubuntu – Execute sh script from *.desktop file

bashdesktopiconsscripts

What I want to do at all, is that:
Create script that has icon on it. So I know only one way – file.desktop file with icon. Settings icon on it was successful, but I have no luck setting EXEC value :/

Can someone explain me a bit how to create executable script with icon on it? create .desktop file and link it to that script? Can someone give me structure of that .desktop file?

Best Answer

You didn't mention what you have tried, so try this:

[Desktop Entry]
Name=someName
Comment=
Exec=/path/to/script.sh
Icon=/path/to/icon
Terminal=false
Type=Application  

Make sure that your script is executable, like this:

sudo chmod +x /path/to/script.sh  

It also won't work with if your script uses the sudo command, or anything else that requires user input.

If you want it to open a terminal window when you run it (if you needed to add input or watch the output) set Terminal to true.

Terminal=true
Related Question