Raspbian | Create Desktop Icon Shortcuts

Desktop icons are the most intuitive way to launch applications. I have created four icons as you can see from the above screen shot . Generally the process for creating a desktop icon is to create a file which resides on the desktop with the following naming convention.

appname.desktop

For the simplest case.  The MineCraft icon is created making a minecraft.desktop file on the desktop with the contents.

/home/pi/minecraft.desktop

[Desktop Entry]
Name=MineCraft
Comment=MineCraft Pi Edition
Icon=/usr/share/pixmaps/Minecraft_icon.png
Exec=minecraft-pi
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;

Basically whatever is the int Exec tag gets run when the user clicks it. the Icon tag is the path to the icon image. The comment is displayed when the user hovers over the icon.

/home/pi/scratch.desktop

[Desktop Entry]
Name=Scratch
Comment=Scratch programming for kids
Icon=/usr/share/pixmaps/Scratch_logo.png
Exec=scratch
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;

Sometimes you have to do a little tweaking. For the Little Crane game, the startlittlecrane.sh script by default wants to be run from the directory where it resides. Go ahead and create the desktop file first.

/home/pi/crane.desktop

[Desktop Entry]
Name=Little Crane
Comment=The Little Crane That Could
Icon=/home/pi/littlecrane/littlecrane.png
Exec=/usr/local/bin/indiecity/InstalledApps/littlecrane/Full/startlittlecrane.sh
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;

but you will also have to modify the following file:

/usr/local/bin/indiecity/InstalledApps/littlecrane/Full/startlittlecrane.sh

Add the following line at the very top before all other commands to:

cd /usr/local/bin/indiecity/InstalledApps/littlecrane/Full/

This way the startup script will move itself into the littlecrane directory prior to executing the program and the desktop icon works as expected.

 

2017-03-08T06:51:40+00:00 0 Comments

Leave A Comment