Next: , Previous: , Up: Window Frames   [Contents][Index]


10.7 Themes

Themes and frame styles are currently almost synonymous, the slight difference being that themes provide a mechanism for loading frame styles from the filing system as they are required. Although it is possible that themes may include other user-interface settings in a later version, at the moment it seems unlikely.

When a frame style is requested, if it is not already available (i.e. if the add-frame-style function hasn’t been called for that style) then the window manager will attempt to load a theme of the same name from the filing system.

Each theme is stored in a directory; this directory must have the same name as the name of the theme itself. Within this directory there must be a Lisp script named theme.jl or theme.jlc. This script will be evaluated, it should provide a frame style of the same name as the theme (by calling add-frame-style).

While the theme script is evaluating the image-load-path variable is set to include the theme directory as its first element. This ensures that any image files stored in the directory can be loaded using the make-image function.

Since rep has no module system, any global variables defined within the theme must be prefixed by the name of the theme to ensure their uniqueness. For example, in the theme foo, a variable bar would actually be called foo:bar.

In most cases however, rep’s lexical scoping can be used to avoid declaring any global variables or functions, the only usual exception is when declaring customization options with defcustom; these must be globally visible.

Since themes are generally passed around very casually, sawfish evaluates all theme code in a very restricted environment; the idea being that themes should only be able to affect the look of the window manager. Despite this, it is still possible for malicious themes to lock, and possibly crash, the window manager; in the first case sending a SIGINT signal may unblock it. Hopefully themes are unable to affect the rest of the user’s environment, but there are no guarantees…

Variable: theme-load-path

A list of directory names, provides the search path for locating theme directories. By default this includes the user’s theme directory and the system theme directory.

Variable: user-theme-directory

The name of the user’s theme directory, by default ~/.sawfish/themes.

Variable: system-theme-directory

The name of the directory holding themes from the current Sawfish version, by default

(expand-file-name "../themes" sawfish-lisp-lib-directory)
Variable: site-theme-directory

The name of the directory holding system-wide themes, by default

(expand-file-name "../../themes" sawfish-lisp-lib-directory)
Variable: theme-update-interval

Number of seconds between checking if theme files have been modified. Default 60.

Variable: themes-are-gaoled

If t, non-nil themes are assumed to be malicious. They will be evaluated in a restricted environment.

Variable: frame-type-fallback-alist

Frame type fallbacks. This is an alist whose elements are (required-type . fallback-type). When REQUIRED-TYPE is not supported by the current theme, then FALLBACK-TYPE is used instead."


Next: , Previous: , Up: Window Frames   [Contents][Index]