Customizing maemo user interface

Goal: This how-to intends to show how to customize themes, sounds, icons and wallpapers on maemo, and how basic customization can be done.

Target audience: Designers interested in customizing maemo and developers interested in knowing how theme creation works.

Pre-requisites

  • Familiarity with maemo Platform
  • Familiarity with package installation
  • For a part of the tutorial, the ability to connect to the device via SSH
  • For manual customization, X-terminal and/or open-ssh installed on the device and device on R&D mode
  • Drawing program capable of editing svg-files, e.g. Inkscape or a drawing program capable of editing png-files

Rationale

Many people find it interesting to customize their devices to suit their own tastes. maemo supports various kinds of customization. Theme, icons, sounds, font and other things can be changed. Some customization is simpler than the other, one of the simplest customization currently being drawing your own theme which is supported with theming tools. Theme means basically the set of graphics that represent the look of the device - in other words, pictures that are placed on top of the widgets, panels, titlebars etc. to decorate them to a desired look (without theme, gtk user interface would look very plain with no fancy eye-candy at all). In maemo the theming is a bit different from Desktop Gnome theming because the maemo themes heavily rely on heavy use of bitmap images whereas in standard Gnome desktop there are less themeable components.


Plankton development theme as represented on Chinook on Scratchbox

Introduction

This document shows some basic possibilities to customize maemo themes and layouts using pre-existing helper tools and manual editing of layout definition files. maemo uses Matchbox as the window manager on top of the X server and thus, Matchbox tutorials will be referred to here, as well.

As basic customization, it is possible to change, for example, just graphics and sounds by replacing the original file. This is not the best way to do it, but it will enable basic customization for end users. It is also possible to create the installation script on the package installing the customization to back the old files up and in case of uninstallation, copy the original files back. Creating a theme instead of just replacing files is a lot better way to do it. However, on time of Chinook, sound themes are not unfortunately supported and changing sounds requires replacing the original files. The same thing applies with icons. Icon themes are not selectable on the device, there is always only one icon set selected and it can not be changed other than by replacing its contents.

This document explains how to create a basic theme step by step by using theme creation template and tools, and how to test the new theme on the device. Also file reference information to the theme files is included for easy tweaking and also some brief instructions how to customize sounds and icons are included.

Theme

Theme is a set of graphics and instructions for the system how to show them up. Theming tools are provided to make this task easier so that the tool does the "programmer's task' for the graphics designer and all you have to do is to draw the own images on top of the template.

A theme package consists of graphics and layout files. The graphics can be easily modified by simply replacing the bitmap images of the theme. Layout can be also tweaked if needed or alternatively the default layout can be used. Each maemo version comes with a specific default layout where the number in the end of the package name represents the maemo-version. The graphics designer does not need to care of these other than answering the question which theme layout version to use in the hildon-theme-bootsrap command (for Chinook the version is 4).

Icons are not part of the theme, so they have to be edited separately. An index to the icon files is provided.

Basic view of Hildon Desktop

Basic view consists Task Navigator bar, Status bar and Home, each have their own pixmap images or couple of images they are build of. The icon shown on the Task Navigator is one of the icons on the device and it is not changed along with the theme but has to be changed separately.

Simplest customization

Users can do very simple customization by themeselves by for example changing the background image. Any image (from the supported file types) can be applied as background image with several different kind of scaling and stretching options. These include Centered, Scaled, Stretched, Tiled and Cropped. In devices bundled with the software on the level of Chinook SDK, the themes can have translucent areas and a change of simply a background image can have a dramatic effect of the look and feel of the desktop. The selection of background image hence is recommended to be done very carefully.

Downloading themes from Internet and installing them on the device

To alter the default look of the maemo device, the simplest way to change it to suit the tastes is to check from Internet if there are ready-made themes available. One possible page is to go to www.maemo.org downloads page and type keyword theme to the search box. Please make sure before installing a theme that somebody else created that it is compatible with the software release you are using.

Some themes also customize icons and sounds as explained on this document. Be prepared that after installing a such theme, there may not be going back to the original icons or sounds if you haven't backed them up manually from command line or the theme installer doesn't back them up. To return the original icons and sounds once you have overwritten the original ones may require reflashing the device or copying the icons and sounds manually from another maemo-device running exactly the same release.

Installing theme package on maemo Device

Theme package that is made installable for the Application manager can be simply installed to the device by transferring the .deb -package into the device via memory card or by downloading it from the Internet. Alternatively if you have setted up the device in R&D-mode and have installed ssh, you can scp it to the device from Linux console. If you want to install it still with the application manager, it is advisable to put it into a directory which is visible to the application manager. A recommended place usually could be /media/mmc1 or /media/mmc2 (as the memory cards are kept intact even if you need to reflash the device).

Currently theming is made of fixed size pixmap images. It is thus suitable only for exactly the same resolution than it was designed for. The form factor in the Internet tablet devices is 800x480 and the graphics drawn on top of the template will be good for exactly that resolution. However, maemo can run also on other resolutions, e.g. it can be even compiled on a laptop. In such case, if you need some other size graphics, the template provided with the Test theme will no longer apply.

KNOWN LIMITATION: When you install & apply a new theme on the device, the background image is not automatically changed to a matching one. To change the background image, the user has to go to Home menu - Background. There is a hackish workaround to this, which is explained later: you can put to your installation script a line that replaces the home-background.conf with your own custom one. However, in general, using that is not recommended.

Getting started with theming and understanding what needs to be done

First of all, a theme package is needed. If the theme is created by team of different persons (e.g. designers and programmers), the first thing to do is the programmer's task to create a theme package with theming tools (that is explained later on this document).

Second thing is the designer's task. Take the template.svg from the created theme package (the theme tools automatically attach this file on the theme). The task is to draw own theme on top of that.

When the theme is finished, the designer exports the drawn image as bitmap on top of the template.png on the subfolder template on the theme package (it has to have exactly the same dimensions than the original template.png).

When the template.png is saved, the theme can be built with dpkg-buildpackage -rfakeroot as explained later in on this document.

As mentioned already, the icons are not part of the theme package. That is partly because different icon themes are not supported on current maemo version. If the designer wants to alter the icons, they have to be changed manually and an installation debian package is needed to be created by the programmer. The installation script on that package is responsible of putting the pictures on correct folders on the device. This process completely overwrites the original icon files from the device.

A Quick Start with Hildon Theme Tools

A quick way to create a new theme is to use hildon-theme-tools package, which is available for Scratchbox and Ubuntu desktop. First, you must install both hildon-theme-tools and hildon-theme-layout-4 packages in order to be able to create, edit and package your theme.

After installing the packages you have the command 'hildon-theme-bootstrap' available. Run it in command line and you'll be asked some basic questions about your theme. It will create a new theme directory and fetch the current basic theme from subversion (N.B. if you run on a desktop machine instead of Scratchbox, you need to install also subversion in order to make things work. In Scratchbox this tool is already available). Here is an example of running hildon-theme-bootstrap (user commands in red):

$ hildon-theme-bootstrap
Theme bootstrap tool by Michael Dominic K.
Copyright 2007 by Nokia Corporation.

This tool will bootstrap a new theme directory structure.

Which layout do you want to use?
1) hildon-theme-layout-3
2) hildon-theme-layout-4
#? 2

What's the theme name? [ie. My Theme]
#? Theme 1

What's the theme directory? [ie. mytheme]
#? theme1

What's the author name? [ie. John Doe]
#? Mr maemo

What's the author's e-mail? [ie. john_doe@gmail.com]
#? xxxx@maemo.org

Summary:

Theme name      : Theme1
Layout          : hildon-theme-layout-4
Package name    : hildon-theme-theme1
Theme directory : theme1 [/usr/share/themes/theme1]
Author          : Mr maemo 

Is this correct? [y/n]
#? y
Fetching source from subversion repository...

After that you will have folder called hildon-theme-theme1. It contains some files, out of which the most important is template/template.png, containing the theme graphics. You're free to edit it with your favourite graphics editor.

When done with editing, you must make a theme package. In order to make the package, change to the directory containing your theme and run the packaging command as follows:

$ cd hildon-theme-theme1
$ dpkg-buildpackage -rfakeroot -b

If everything went fine, you should have hildon-theme-theme1_VERSION.deb file in the parent directory. The file can be transferred to the device and installed with Application Manager.

Now you're done with the customization of the theme, if you wish you can proceed with manual editing process to gain a full access on theme layouts.

For a more thorough tutorial on hildo-theme-tools, visit the following link: Hildon Theming Overview

The theme package automatically installs its contents to /usr/share/themes on the device.

Image reference with pixel sizes for manual customization (Plankton theme)

The images of the theme reside on the device on the following folder: /usr/share/themes/[Theme name]/images, for example:
/usr/share/themes/plankton/images

Specifications of images are presented on a separate page. Click here to see the theme image index.

How to create a debian package for your custom data files

To install files you customize on the device, a programmer needs to create a debian package. There are other tutorials on maemo.org about how to do that in detail, but here is a dummy example package that you can copy-paste for your projects if you like. Please look at the contents of the package to learn how it works, it is not in scope of this document, so it is not explained in more detail here. You have to make changes to configure.ac, debian/control, debian/rules, yourdatadir, yourdatadir/Makefile.am, yourdatadir/installable_file to modify it to suit your purposes (you can modify and use it to install sound, graphics, icon, wallpaper etc. files on the device or Scratchbox).

Download the package dummy-package_0.0.1.tar.gz from here.

You'll need this knowledge later in this tutorial in order to be able to package your data files (such as icons, sounds or wallpapers) to the device.

Customizing Icons

In order to customize Task Navigator, Status Bar, Control panel and other icons you must manually change the icons located in the device. The icons that come with maemo SDK (and that are included on the icon index part of this document) are not the same ones than you can see on the device. If you want to change just couple of icons and not all of them, please make sure that you install only those and do not install the whole icon set from the maemo SDK because it overwrites the product icons with a less polished set which is not a recommended thing to do.

Task Navigator Icons

The main icons used in maemo, such as Internet browser, Application menu, Mail and the status bar icons can be modified just by changing the images in the following directory: /usr/share/icons/hicolor/scalable/hildon/

The icons can be customized by changing the following images. Again, the original ones should be backed up first. Also, the same file format and image size should always be used. All icons are 8-bit, 64x54 pixels .png images.

Preview Description File name
qgn_grid_tasknavigator_contact.png Contacts qgn_grid_tasknavigator_contact.png
qgn_grid_tasknavigator_contactactive.png Active Contact qgn_grid_tasknavigator_contactactive.png
qgn_grid_tasknavigator_newmessage.pngn Mail / Inbox qgn_grid_tasknavigator_inbox.png
qgn_grid_tasknavigator_newmessage.png New message qgn_grid_tasknavigator_newmessage.png
qgn_grid_tasknavigator_sendrecieve.png Sending / Receiving qgn_grid_tasknavigator_sendrecieve.png
qgn_grid_tasknavigator_web.png Web Browser qgn_grid_tasknavigator_web.png
qgn_grid_tasknavigator_others.png Others / Menu qgn_grid_tasknavigator_others.png

Status bar icons

Also the status bar icon can be customized. Battery status, volume status, connection and phone are multiple state icons, so every single state image should be customized.

Files are located in the directory /usr/share/icons/hicolor/40x40/hildon/

Icon File name Icon File Name
full battery qgn_stat_battery_full100.png brightness 4 qgn_stat_displaybright4.png
75% battery qgn_stat_battery_full75.png brightness 3 qgn_stat_displaybright3.png
50% battery qgn_stat_battery_full50.png brightness 2 qgn_stat_displaybright2.png
25% battery qgn_stat_battery_full25.png brightness 1 qgn_stat_displaybright2.png
battery low qgn_stat_battery_low.png USB active qgn_stat_usbact.png
battery very low qgn_stat_battery_verylow.png Alarm active qgn_stat_alarmact.png

Battery, Brightness, USB and Alarm icons listing.

Icon File name Icon File Name
internet connection qgn_stat_internetconn_generic.png volume 4 qgn_stat_volumelevel4.png
Ad hoc Wlan qgn_stat_internetconn_adhocwlan.png volume 3 qgn_stat_volumelevel3.png
Internet connection data call qgn_stat_internetconn_datacall.png volume 2 qgn_stat_volumelevel2.png
Internet connection packet data qgn_stat_internetconn_packetdata.png volume 1 qgn_stat_volumelevel1.png
no internet connection qgn_stat_internetconnection_no.png volume 0 qgn_stat_volumelevel0.png
volume mute qgn_stat_volumemute.png

Connection and volume icon listing

Image reference with pixel sizes for manual customization of icons

The images of the theme reside on the device under the following folder: /usr/share/icons/hicolor/ under the following subfolders:

    scalable/hildon
    40x40/hildon
    250x250/hildon
    26x26/hildon
    12x12/hildon
    34x34/hildon
    50x50/hildon
    16x16/hildon
    

Specifications of images are presented on a separate page. Click here to see the icons image index.

Designer's task: draw new icons with exactly same sizes as the original ones and save them on the place of the original ones with exactly same file names (please see the icon index for reference).

Programmer's task: Please see the maemo debian packaging tutorial to understand how to create the package that installs the files on correct locations and that is installable with the Application Manager. It is recommended that the theme package only replaces the customized icons and not the whole set unless all the icons are new ones and the customization is not limited changing just couple of icons.

Editing Theme Layouts Manually

This chapter explains how to edit theme layouts manually. This allows broader customization of the device extending beyond mere modification of graphical elements.

Editing layout files enables the modification of the following:

  • Font sizes and styles
  • Widgets parameters (spacings, margins, distances)
  • Hildon desktop parameters (Task Navigator size, place etc.)

N.B. Note that the modification of colors and graphical elements is easier with hildon-theme-tools than by manipulating layouts. This should be sufficient for most customization needs.

Layouts can be edited either by modifying already existing layouts or creating custom layouts. For instance, in order to apply changes to the package created by hildon-theme-tools you can edit files under /usr/share/hildon-theme-layout-4, if hildon-theme-layout-4 has been installed. The layout files for the selected layout are used for the theme created by hildon-theme-tools. If you want easily installable themes, it is the preferred way to edit these files.

Theme Files

After installation, all maemo themes are located in the following directory: /usr/share/themes/[Theme_name]

All themes share the same structure, having a pretty straightforward meaning:

      gtk-2.0/
          gtkrc
          gtkrc.maemo_af_desktop
      images/
          *.png
      matchbox/
          theme.xml
      index.theme
    

Theme.xml

Some simple window decoration customization can be achieved by modifying the theme.xml. In the maemo platform, the theme.xml defines the main title bar decoration and some dialog decoration as well. More information on theme.xml files can be found in the Matchbox themes tutorial.

Basic Resources

There are three basic resources in a theme.xml file: colors, fonts and pixmaps. All of them have to be declared before using. The syntax is pretty straightforward:

For colors:

 
    <color id="lowlightcol" def="#d4e6fd80" />
    

basically it is an "id" followed by a definition, the element real value.

For fonts:

      
    <font id="osso-TitleFont" def="Nokia Sans-16.75:30px" />
   

or

  
    <font id="osso-TitleFont" def="Nokia Sans,fixed bold 16.75" />
    

again, an id and a definition. In font elements, alternative fonts can be defined by separating them with "|" (pipe). The first match will be used.

A valid font must be used. To avoid problems, the pipe character "|" should be used to give the default Nokia sans font as second alternative: def="your Font,fixed bold 16.75 | Nokia Sans,fixed bold 16.75"

For Pixmaps ( images ):

      
    <pixmap id="dialoguptile" filename="../images/qgn_plat_note_frame_tile_top.png" />
    

Id followed by a filename, pointing to a png image.

An example of a layout file can be seen in the hildon-theme-layout-4 package.

gtkrc customization

After modifying theme.xml and the basic images and fonts, the next step on maemo customization and theme creation is to modify the GTK resource file and the resources used by it. This will enable changing the visuals for almost everything else in the system, including the Hildon widgets.

Even with the gtkrc file giving control over some important things, it is recommended to modify only the images in the folders that are used by the gtkrc file. The gtkrc file is too big to describe in full detail in this document.

N.B. It should be noted again, that the most important GUI elements can be modified using the hildon-theme-tools template.

Modifying System-Wide Colors

Some sections of the gtkrc file have to be changed to match the colors of the theme. Most color definitions are located in the beginning of the file. N.B. Be careful not to enter invalid values. If possible, always test on your Scratchbox first.

Modifying System-Wide Fonts

In addition to the colors, the gtkrc file can be modified to make some custom fonts to work on UI. Again, it is very important to use the correct font name and size, or the rootfs may be damaged.

     
style style-Identifier{ font_name="Font Name size"}

Sample of font definition:

style "osso-SystemFont" { font_name = "Nokia Sans 16.75"}

and font usage:

 
class "*GtkComboBox" style "osso-SystemFont"

N.B. This is just a very simple introduction to gtk resource files. The GTK documentation should always be checked, if there are any doubts about the resource files.

Distributing Themes

Themes can be distributed as an Application Manager ready package. This will make it easier for the end users to install and uninstall themes. Themes created using the hildon-theme-tools skeleton are instantly ready for building the package using dpkg-buildpackage -rfakeroot as described above. The resulting .deb file can be then installed on the device using Application Manager by the user.

Adding New Fonts

First step is to create a fonts folder for the user:

cd /home/user/
mkdir .fonts
      

Adding new fonts is pretty simple: the font files ( .ttf or type1) are to be placed in the fonts folder located on:

/home/user/.fonts/
      

To update the font cache, the command fc-cache -fv should be run in the .fonts directory.

To change the fonts used by the whole system, theme.xml file should be modified, as was explained in the document.

How to customize the device sounds

The maemo 4.0 does not support sound-theming, however, you can alter the sounds on the device by changing the original files located into /usr/share/sounds on the device. These files are not included on the SDK rootstrap, so you have to look at these files on the device directly on that location.

The sounds are in wav-format and each sound has its own logical id as its name (which helps you to determine which sound is in question).

Example: 1. Open x-terminal (that you have installed separately from maemo.org to the device, it is not included by default).
2. Type to the X-terminal the following:

    cd /usr/share/sounds
    ls
    

How to make a sound package

Sound designer creates new sounds and saves them to files with the same names than found from the /usr/share/sounds. E.g. if the sound designer wants to create his or her own window opening sound, he or she has to save the sound with the name ui-window_open.wav (please see above how to determine the file names). Each sound file is customized in the same way. Please be sure that the file name is exactly as found on the device, Linux system is case sensitive unlike Windows and e.g. file named ui-new_email.wav has to be exactly ui-new_email.wav and not for example ui-new_email.Wav or ui-new_email.WAV.

Programmer's task is now to create a debian package that installs these sounds on top of the original ones to the directory /usr/share/sounds on the device. Please see the maemo debian packaging tutorial to understand how to create the package that installs the files on correct locations and that is installable with the Application Manager.

Creating a custom background image (wallpaper) and creating a package for it


Example picture, sized 800x480 for using in the maemo devices

The size of the background image is 800x480 pixels. It is a good idea to create the background image to be exactly that size and aspect ratio. However, the software on the device allows you to scale, stretch, crop and tile images that don't exactly fit nicely on the Home area. Best way however, is to have correct size and shape on the image.

In some themes, the Task Navigator and Status bar are translucent and the background image shows up from below the panels. Therefore it is recommended to keep this in mind when you are designing the background image to ensure that it matches with the theme nicely.

The background images shall be installed into /usr/share/backgrounds Each background image shall accompany a .desktop file in order to have it visible on the background image selection dialog. To make a background image as default, you have to replace the contents of file default.desktop in the given location to point out to the custom background image.

Format of .desktop -file for a background image:

        [Desktop Entry]
        Type = Background Image
        Name = titleoftheimage
        File = /usr/share/backgrounds/imagename.png
        X-Order=01
    

Example Puro.desktop:

        [Desktop Entry]
        Type = Background Image
        Name = Stream Scene from Lappland
        File = /usr/share/backgrounds/puro.png
        X-Order=01
    

Download puro.desktop by clicking here.

To make that default, you have to also put the same information inside the default.desktop, default.desktop contents should then look like this:

        [Desktop Entry]
        Type = Background Image
        Name = Stream Scene from Lappland
        File = /usr/share/backgrounds/puro.png
        X-Order=01
    

Download default.desktop by clicking here.

To make the new image to be default on next boot of the device, you have to configure also hildon desktop. The configuration entry is in yourhomedir/.osso/hildon-desktop/home-background.conf (/home/user/.osso/hildon-desktop/home-background.conf on the device and /home/yourusername/.osso/hildon-desktop/home-background.conf)

The contents of the home-background.conf
Please note that this is not recommended for packages you create as users may not like if their favourite background image gets replaced without questions. However, this is the way to implement it.

    
        [Hildon Home]
        BackgroundImage=/usr/share/backgrounds/puro.png
        CachedAs=
        Red=0
        Green=0
        Blue=0
        Mode=Centered

    

Download the source for this example package by clicking here.

To create a simple package for your own custom background image, you can uncompress this archive, edit the configuration to use your custom image instead. Build it and if you did everything correctly and there were no errors, you are done and your background image package is ready for distribution.

Download the debian package installable on Chinook (either device or Scratchbox) from here.

TIP: Try installing the wallpaper package in scratchbox:
fakeroot dpkg -i puro-background_0.0.1_all.deb

Start desktop environment:
export DISPLAY=:2
(outside scratchbox start Xephyr)
inside scratchbox:
af-sb-init.sh start
Observe the Xephyr Window

3rd party theme packages and theme tools

Some developers have made their own themes and tools. For example Urho Konttori has made a Java-based theme-maker which runs on any OS and does the installable debian package automatically for you. However, please contact the maker of the given tool to inquire about the updateness of the tool etc. - theme packages created for Bora and theme tools created for Bora do not work on Chinook because there have been number of changes in theming in Chinook.



Improve this page