HowTo make desktop icon for Python script in Maemo

There are several steps to get a standard icon in the program menu and as a desktop shortcut to that program.
I assume you have a working Python script, which you call in XTerminal by typing:
python yourscriptname.py
Obviously you will need an icon, in this case in 48×48 size, preferable with transparent background.
Then you do in XTerminal: (first become root by typing ’sudo gainroot‘)

  • Your Python script yourscriptname.py should be put under the /opt directory, in a new directory like yourscript.
    So that its path is: /opt/yourscript/yourscriptname.py
  • Make up an icon in the size of 48×48 pixels, and PNG format. Name it ‚yourscripticon.png‘.
    Put it into /usr/share/pixmaps or put it somewhere under /opt, and make a softlink in /usr/share/pixmaps pointing to that icon.
  • Make up a simple callable script named ‚yourscript‘ for the correct calling of your Python script just as this 2-liner:
    #!/bin/sh
    exex python /usr/bin/yourscriptname.py

    and make it executable (chmod a+x yourscript).
  • put that script under that simple name ‚yourscript‘ into /usr/bin
  • make up the following desktop file ‚yourscript.desktop‘ in /usr/share/applications/hildon :
    [Desktop Entry]
    Encoding=UTF-8
    Version=1.0
    Type=Application
    Name=Pretty Name of your Script
    Exec=/usr/bin/yourscript
    Icon=yourscripticon

    Note to not use the .png extension in this .desktop file.
  • Finally, either restart your Maemo device, or call the Hildon recache commands if you know them (I don’t 😉 )

Your Python script will appear in the Hildon app menu (probably way down the list) and you can use the normal desktop menu to create a desktop shortcut for your app, if you like.

Thank you Khertan for the clean .desktop prototype of your pygtkeditor app!

Leave a Reply

You must be logged in to post a comment.