UniversalThemes

Universal themes: working draft

This is a working draft

It is not finished yet and it has not been approved or adopted by anybody. Feel free to discuss it in the xdg mailing list.

This proposal is similar in intent to the ThemePackageSpec, a summary of the differences can be found here.

Introduction

Judging by the number of themes submitted to kde-look.org, art.gnome.org, xfce-look.org and gnome-look.org, customising the look and feel of a free desktop is important to users. Unfortunately, the situation is far from ideal:

Attempts have been made to fix some of these problems, especially in KDE. For example, KDE includes “theme-manager themes” which are able to link to several different types of themes, as well as include a wallpaper and a colour scheme. This type of theme seems to have been deprecated in KDE 4, however. This proposal suggests a new file type: a universal theme (utheme).

This proposal only a specification of this file format. It does not address how the programs should install and activate files of this format, and it does not address how websites should distribute them. Ideas are given at the end.

Use-case scenarios

Use-case scenario: Jack visits his favourite website for customising his desktop. He finds a GTK theme that he likes, clicks on the link and downloads it to his desktop. The file has a handy little thumbnail, allowing Jack to preview the theme before installing it and giving him confidence that the file is not badly packaged. He double-clicks on it. A program automatically launches, installs it and activates it for him.

Use-case scenario: Sandra is browsing her favourite website, and is overwhelmed by the number of different types of themes she can install. Fortunately, she sees a category called “complete skins”. She browses skins by colour, and downloads a green one to her desktop. The file has a handy little thumbnail. She double-clicks on it, and a program automatically launches, installs it and activates it for her. Her entire desktop has changed looks, including her wallpaper, window decorators, widgets, log-in screen and boot-up screen.

Use-case scenario: Jessica is a theme designer. She is keen on creating coherent themes that are easily installable. She packages the themes in the utheme format, and she creates a “meta-skin” utheme that links them all together. She uploads these files to kde-look.org. She blogs about her latest creation, linking to the meta-skin utheme. Users of KDE can download and install this meta-skin easily. Behind the scenes, GHNS retrieves all the linked themes automatically.

Use-case scenario: Songbird developers have chosen to use their own theme format to customise the look of their program. However, they want to make this new theme format accessible to a maximum number of people. They choose to support utheme, meaning systems automatically know how to categorise and thumbnail it. Songbird themes can be included in skins as well.

File format

File format properties

Notes/Questions

Format

a zip archive, with zero compression (.zip)

Zips are suitable for fast extraction of single files (essential for indexing and thumbnailing)

Extension

.utheme

The extensions .theme and .thm have been taken already. A unique extension will make mime-type detection simple.

Mime-type

application/x-utheme

Magic number

undecided, not needed?

File format contents

The contents of this compressed archive will be:

File

Description

Notes

thumbnail.png

A small thumbnail of the theme. Required.

preview.png

A large preview image of the theme. Required.

utheme.xml

An XML document containing information about the theme. Required.

XML is a well defined mark-up language, easily parsed by most APIs. Alternatives to consider are INI files, or a custom configuration file. XML fits well with RDF as well, which is perfect for meta-data.

COPYING

A text file containing copyright information about the theme. Optional. If not provided, information about copyright is assumed to be in utheme.xml

data/

A directory which contains any files used by the theme. Required (even if empty)

This directory could be eliminated, putting the needed files directly in the root of the archive. Because the utheme is uncompressed, the theme creator could choose to put a compressed archive in this directory, for example, a .tar.gz archive.

File format requirements

A theme packaged by utheme should be installable as-is on the intended target destination, it should not have to compiled for different architectures or systems. Themes that need to be compiled (like Usplash themes, or KDE's styles, or screensavers) are not supported by utheme, they should be packaged in the way binaries are usually packaged on the system.

utheme.xml requirements

The utheme.xml should contain the following information:

utheme.xml optional elements

utheme.xml can optionally contain the following information:

list of theme colours, including: white, lightgrey, grey, darkgrey, black, beige, lightbrown, brown, orange, yellow, lightgreen, mediumgreen, green, lightblue, mediumblue, blue, darkblue, purple, red and pink

Skins and meta-skins

This specification describes two special theme type: skins, and meta-skins.

A skin is a collection of various themes of different types. They allow users to combine several themes into one coherent whole. Any number of themes can be included, but no more than one of each type, unless one is a dependency of another. These themes are included in the data/ directory of the compressed archive, and the file named utheme.xml lists them in the section specific to skins.

A meta-skin is not a theme in itself, rather, it links to other themes by their code names and types. They allow users to collect several themes into one coherent whole. Any number of themes can be linked to, but no more than one of each type. Meta-skins can optionally point to URLs where the uthemes can be downloaded, but this information can be ignored by the the program. A meta-skin is to a utheme what a meta-package is to a package in APT. It is useful in spaces where repositories are used, like GHNS. Meta-skins are still uthemes, but they have empty data/ directories.

Existing theme file formats

List of themes used in GNOME and KDE:

Theme type

Current packaging

Suggested unique theme type string for utheme.xml

Desktop background

Just an image file, sometimes a .xml file with images

wallpaper

Metacity border theme

.tar.gz

metacity

Xfce's border theme

.tar.gz

xfwm4

GTK2 controls theme

.tar.gz

gtk2

Icons theme

.tar.gz

freedesktop-icons

X11 mouse cursors theme

.tar.gz

x11-cursors

GRUB bootsplash

.xpm image file

grub

GDM login screen

.tar.gz

gdm

Plasma theme

.tar.gz

plasma

Colour scheme

.kcsrc

kde-color-scheme

KDE splash screen

.tar.gz

kde-splash-screen

GNOME splash screen

Just an image file

gnome-splash-screen

deKorator theme

.tar.gz

dekorator

Aurorae theme

.tar.gz

aurorae

Emerald theme

.emerald

emerald

Emoticon themes for KDE

.tar.gz

kde-emoticons

VLC theme

.vlt

vlc

Amarok theme

.tar.gz

amarok

And so on.

Other theme formats that are in development or could be in development are: Haiku's Theme Manager themes, sound themes, ReactOS icon themes, and so on.

Discussion of alternative ideas

One idea to solve the ambiguity of themes packaged as .zip archives is to assign every theme type a new mime-type and extension. For example, .gtk2 would be assigned application/x-gtk2-theme and .metacity application/x-metacity-theme. Each type of theme would have its own thumbnailer, its own associated program and its own way to package the theme and its meta-data. However, this idea makes it hard to create and maintain skins that link different kinds of themes together. Meta-data is not in one uniform format, which is handy when categorising and searching for themes, say for colour, license or author, on a server or on a desktop.

Another idea is to create “sub-mime-types” of utheme for each type of theme. For example, take a .metacity (application/x-metacity-utheme) which is in the format specified by the utheme specification, but with a different extension and mime-type. The drawback is the large number of new mime-types that would be created.

Another idea is to specify double extensions: the first relating to the type of theme, and the second utheme, for example: filename.metacity.utheme. This would allow easy filtering of files by theme type. I can think of no drawbacks to this, except perhaps the strange file name that would be displayed on Windows systems where extensions are hidden (eg: name.metacity). Applications could choose to create “sub-mime-types” of utheme while retaining the .utheme extension by using this double extension [needs to be confirmed, not possible on Windows at least].

Discussion of program implementation details

Implementing a thumbnailer for uthemes should be a piece of cake: just extract preview.png from the archive.

Several different implementations for a program that handles uthemes can be created, according to the needs of different users. You could have one for GNOME, one for KDE, one for Xfce, etc. The issue lies in how a program should behave when it encounters a theme type it does not know how to handle. There several ways it could choose to behave:

  1. Simply display an error message (eg: "unrecognised theme type: %s"), and possibly ask the user to choose between the options below.

  2. Extract the data and open it using the default handler for it by mime-type. (eg: automatically open .emerald themes) The downside to this is that a lot of themes don't have a dedicated mime-type (such as all the ones that are simply gzipped tarballs).

  3. Open the utheme in the default archive manager for zip archives. This is not very user-friendly.
  4. Access some sort of central configuration file where programs have registered themselves as utheme handlers for certain theme types, and execute the appropriate command. The advantage of this is that installation, removal and activation commands can be added for new theme types easily, and front-end tools won't have to know about how each theme type is handled.

If number four meets approval we could include the configuration details in another specification.