Maemo 5 Desktop Shortcuts

by Tina Holmboe 1th of July 2010 (archive)

Customising the Maemo 5 desktop quickly led me to the conclusion that while it is easy enough adding shortcuts to applications, bookmarks, contacts and widgets, adding shortcuts to files landed me in the twilight zone.

If you’ve read my, or other, reviews you’ll know that by default there are between one and four «virtual» desktops on the N900 laptop/smartphone. Each can be give a background, and you can add any of the above mentioned widgets and so forth to them.

What you can’t — easily — do is add a link to a file. Hence if you have, for example, a PDF you open regularly you’ll have to go open the reader software first, then open the file.

Since this is Linux there are alternatives, of course — using the file manager, or the terminal. Much as I prefer a command–line based interface for speed and productivity, neither of these three are as smooth as having an icon on the desktop.

A note here: the following is not user–friendly by any definition of the word «user» except where also labelled «expert». Fair warning.

After some digging it turns out that Maemo, being related to the Debian Linux distribution, use the so–called «Desktop Entry Specification» as agreed on by the GNOME and KDE projects.

This, in turn, mean that every application on the desktop has a so–called «.desktop» file, normally under the /usr/share hierarchy.

The «.desktop» file define which program to execute, how to do so, the icon to use on the desktop, and so forth. Each file contains a number of lines, separated by a linefeed (LF, or \n) character. Blank lines, and those starting with «#», are considered comments. Non–comment lines consist of key/value pairs. Case is always significant, and the file must be UTF–8 encoded.

Lines starting with «[» define a «group header». For our purpose the only important such is «[Desktop Entry]» which must come first in the file.

The following example is taken from the specification:

[Desktop Entry]
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
Exec=fooview %F

Now we can try adding a desktop icon referencing an executable which opens a specific file to Maemo 5. My experiment involves a PDF–file; a map of the Musée d’Orsay in Paris which I found myself referring to quite often while visiting.

The first step is to create a .desktop file and place it in the proper spot: /usr/share/applications/hildon/orsay.desktop — you will require root access, and I strongly recommend you work on the file in /home/user first, then copy it into place. Normal safety rules whilst playing with fire apply.

Here’s the .desktop I’m using:

[Desktop Entry]
Name=Orsay Map
GenericName=Shortcut to file
Comment=Map of the Musée d'Orsay
Exec=/usr/bin/evince "/home/user/MyDocs/.documents/Archive/PDF/Orsay.pdf"

You can find the definition of each key in the desktop entry spec, listed in the references down below. For now, let’s look at how Maemo deal with some of them.

When using the desktop menu to select an application, the value of the «Name» key will appear in the list. The «Comment» field, meant as a tool–tip, is not applicable as far as I can tell; neither is «GenericName».

The «Icon» key should, theoretically, reference either an icon name – from which a specific field is determined by an internal algorithm – or an absolute path. In reality the absolute path would appear a more robust method, as you otherwise need to know which directories are searched for a match.

«Exec» is the important bit in all of this. Here you’ll enter the name of a program — in my case /usr/bin/evince — and, to have it open a specific file, the path, preferably, to the file in question.

It all hinges on the ability of said program to accept command–line options, of course. Evince, which has some advantages to the standard Maemo PDF reader, can.

The final step is to create a 64x64 PNG icon, and stuff that somewhere suitable — the above /opt/usr/share/icons/hicolor/64x64/apps is not mandatory as long as you stick with full paths. If you do not create an icon, one will be provided for you — and that one might not be helpful at all in differentiating one PDF from another. There is no way that I can find to include text — so do that in the PNG.

Once the .desktop file is created, and the icon artistically designed, use the normal method for adding a shortcut to a desktop: tap, gently, the desktop, tap, gently, the cog in the upper right–hand, then select «Desktop Menu», «Add shortcut», and look for the desktop entry you just wrong («Orsay Map» in my case). Drag the icon to where you want it, and tap «Done». You’re done. Obviously.

Sadly I can’t for my life claim this as an «easy» method to create shortcuts to files. Ideally I’d open the file manager, select a file, open the context menu, pick «Create shortcut», fill in the name I’d like, and have a link appear on the desktop.

Something for PR 1.3, Nokia?

PS: If the above brick your device, you didn’t hear it from me.


* *