SLiM fork – THEME howto

Home Themes Project page

This page presents some basic information regarding the slim theme format. Read this if you plan to make or modify a theme for the program. Do also, of course, have a look at the included themes.

General Concept

A SLiM theme essentially consists of three files:

  • a background image (background.png or background.jpg)
  • a panel image (panel.png or panel.jpg)
  • input box(es) and messages and their placement and properties (slim.theme)

The image files provide the visual effect. The panel is blended into the background image, taking care of alpha transparency, at a position defined by the theme file.

Various textual elements ‐ prompts, entries, etc. ‐ are drawn onto the result.The slim.theme file defines the appearance and content of these textual elements.

Text Entry Boxes

It is conventional in GUIs for text that the user enters to be placed in a box. Most display managers do this with the username and password. SLiM does not explicitly draw any such boxes, thus giving the theme writer full freedom. If such boxes are desired, they should be drawn on the panel image. The position of the text entries will need to be set to line up with those drawn boxes.

File Formats

The panel and background images can be PNG or JPEG files. As of V1.4.0, the background image file is not required if the slim.theme file specifies a plain colour background.

If the panel is to have transparency then it must be a PNG and must not use colour palette mode.

The slim.theme file is plain text in the same syntax as the main SLiM configuration file. It would usually contain a different set of options but there may be some overlap.

Text Element Definitions

In general, a textual element of the theme will be specified by a set of eight options which share a common prefix. In some cases there are more, or fewer, but the default set are:

  • ..._msg

    For prompts and messages, this option defines the text to be shown. If not plain ASCII, it must be UTF-8. This option is not used on interactive text elements.
  • ..._font

    Specifies the font, using the xft font specs, e.g. Verdana:size=16:bold
  • ..._color

    The colour to render in, using html hex RGB format, e.g. #0066CC
  • ..._x
    ..._y

    The position on the screen. Values can be either absolute in pixels or proportional to the container, e.g. 50% is in the middle.

    Note that some messages are drawn on the background while others are on the panel. Their coordinates are relative to the respective surface. If drawn on the background, the placement must be clear of the panel, otherwise the text will be hidden.

    In many cases, setting these to -1 has a special meaning, usually to disable the message in question.

  • ..._shadow_color
    ..._shadow_xoffset
    ..._shadow_yoffset

    Most text elements, other than input fields, support a shadow effect. These options configure the colour and size of that shadow. Setting both offset values to zero will disable the shadow.

Options

The following options are valid and expected in a theme definition:

background_style

Determines how the background image is used. The valid values are:

  • color

    The background is a plain colour. From V1.4.0 this option means the background.jpg file is not required. Earlier versions needed it to exist but did not use its contents.

  • center

    The background image is centred on the screen. If the image is smaller than the screen then the surrounding area is filled with a plain colour.

  • stretch

    The image is expanded to fill the screen. The aspect ratio is NOT preserved, so square images will appear distorted on widescreen displays.

  • tile

    The image is tiled, starting at the top left corner and repeating to fill the screen.

background_color

When the background style is either color or center, this option specifies the colour to fill (the rest of) the screen with, in hex RGB.

input_panel_x
input_panel_y

These two options specify the position of the overlaid panel image. They can be given as absolute pixel values, in which case they define the top left corner, or as percentages of the screen size, in which case they specify the centre of the panel.

input_...

This extended text element option set defines the appearance of the text being entered by the user into the username and password "boxes". The set is unusual as the position options are split, so instead of input_x/y there are input_name_x/y and input_pass_x/y for the entered user name and password respectively.

The text input positions are specified relative to the panel. This must be in absolute coordinates, to line up with the entry decorations.

If the password positions are given as -1 then SLiM uses single entry mode, where the password and username are entered at the same position and only one of them is shown at a time.

There is obviously no input_msg option!

welcome_...

This full text element option set defines a welcome message to be displayed on the panel. Some theme authors prefer to render a graphical welcome, so setting the position options to -1 hides the message.

The positions are specified relative to the panel. They may be either absolute or proportional.

Variable substitution is carried out on the message, so that any occurrence of %host or %domain in the welcome_msg will be replaced by the hostname or network domain name of the computer, respectively.

username_...

This full text element option set defines the message to be displayed as a prompt for the user name to be entered. As above, position values of -1 disable the prompt.

The positions are specified relative to the panel. They may be either absolute or proportional.

password_...

This minimal text element option set defines the message to be displayed as a prompt for the user name to be entered. Only the _msg, _x and _y are allowed ‐ the other elements are inherited from username_....

msg_...

This partial text element option set defines how status messages are displayed. Negative values are not allowed ‐ the messages cannot be disabled. There is obviously no msg_msg option.

The positions are specified relative to the full screen background.

session_...

This full text element option set defines how the selected session is displayed when the user presses F1. Negative values are not allowed ‐ the message cannot be disabled.

The session_msg option only defines the prefix of the message ‐ the selected session name will be appended to it.

The positions are specified relative to the full screen background.

passwd_feedback_...

This minimal text element option set defines the message to be displayed if a login attempt fails. Use negative position values to disable the message.

Only the _msg, _x and _y are allowed ‐ the other elements are inherited from msg_....

The positions are specified relative to the full screen background.

passwd_feedback_capslock

This option is currently disabled. It was intended as an alternative message to be used if the caps lock key is on, which is a common cause of incorrect passwords.

Example

The following is an example slim.theme file
    # Place the background image centred with a red border around it
    background_style        center
    background_color        #FF0033

    # Color, font, position for general messages (e.g. shutting down)
    # White text with a small grey shadow, placed top centre
    msg_color               #FFFFFF
    msg_font                Verdana:size=18:bold
    msg_x                   50%
    msg_y                   30
    msg_shadow_color        #888888
    msg_shadow_xoffset      2
    msg_shadow_yoffset      2

    # Make the session prompt a bit smaller, centre bottom, pale green
    # with no shadow
    session_color           #DFFFEF
    session_font            Verdana:size=16:bold
    session_x               50%
    session_y               90%

    # Put the panel slightly above the middle
    input_panel_x           50%
    input_panel_y           40%
    
    # Welcome message position. (relative to the panel)
    # use -1 for both values or comment the options to disable
    # the welcome message
    welcome_x               50%
    welcome_y               38
    
    # Font and color for the welcome message
    welcome_font            Verdana:size=16:bold:slant=italic
    welcome_color           #d7dde8

    # Input controls horizontal and vertical positions relative to
    # the panel.
    # Set input_pass_x and input_pass_y to -1 to use a single input
    # box for username/password (GDM Style).
    # Note that these fields only accept absolute values.
    input_name_x            40
    input_name_y            100
    input_pass_x            40
    input_pass_y            120
    
    # Input text in a smaller font, black text
    input_font              Verdana:size=12
    input_color             #000000

    # 'Enter username' font and foreground/background color
    username_font           Verdana:size=12
    username_color          #d7dde8

    # 'Enter username' and 'Enter password' position (relative to the panel)
    #  use -1 for both values to disable the message
    # note that in case of single inputbox the password values are ignored.
    username_x              50%
    username_y              146
    password_x              50%
    password_y              146

    # The message to be displayed. Leave blank if no message
    # is needed (e.g. when already present in the panel image)
    username_msg            Please enter your username
    password_msg            Please enter your password
    
    # Optional message to show on a failed login. Similar set of values
    # to the above. Use -1 for the x & y to disable (default).
    password_feedback_x     50%
    password_feedback_y     165
    password_feedback_msg   Authentication failed
    # The font and color are inherited from msg_xxx