How to bind a script to a desktop item

This small tutorial describes how to set up a desktop icon for a new script.

It uses as example the calendar synchronization script.

For setting up an icon, two things are needed:

  1. a .desktop file
  2. the icon itself (a png image)

The .desktop script

The .desktop file should be placed into the /usr/share/applications/hildon/ directory.

Its contents may be as follows:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Name=Synchronize Calendar
Exec=osso-xterm /usr/local/bin/syncCalendar
Icon=sync
X-Osso-Type=application/x-executable

Putting osso-xterm before the name of the script ensures that a terminal is launched so that you can see its output. This is not needed for scripts that open their own window.

The icon

The icon is a png file of 64x64 and should be placed in the directory /opt/usr/share/icons/hicolor/scalable/hildon/ directory.
Last modified: Sat Sep 10 18:43:29 CEST 2011