D.2. The skin file
Prev | Appendix D. MPlayer skin format | Next

## D.2. The skin file

As mentioned above, this is the skin configuration file. It is line oriented; comment lines start with a '`;`' character at the beginning of the line (only spaces and tabs are allowed before the '`;`').

The file is made up of sections. Each section describes the skin for an application and has the following form:

    section = section name
    .
    .
    .
    end

Currently there is only one application, so you need only one section: its name is movieplayer.

Within this section each window is described by a block of the following form:

    window = window name
    .
    .
    .
    end

where `window name` can be one of these strings:

- main - for the main window

- sub - for the subwindow

- menu - for the skin menu

- playbar - playbar

(The sub and menu blocks are optional - you do not need to create a menu or decorate the subwindow.)

Within a window block, you can define each item for the window by a line in this form:

    item = parameter

Where `item` is a string that identifies the type of the GUI item, `parameter` is a numeric or textual value (or a list of values separated by commas).

Putting the above together, the whole file looks something like this:

    section = movieplayer
      window = main
      ; ... items for main window ...
      end

      window = sub
      ; ... items for subwindow ...
      end

      window = menu
      ; ... items for menu ...
      end

      window = playbar
      ; ... items for playbar ...
      end
    end

The name of an image file must be given without leading directories - images are searched for in the `Skin` directory. You may (but you need not) specify the extension of the file. If the file does not exist, MPlayer tries to load the file `<filename>.<ext>`, where `png` and `PNG` are tried for `<ext>` (in this order). The first matching file will be used.

Finally some words about positioning. The main window and the subwindow can be placed in the different corners of the screen by giving `X` and `Y` coordinates. `0` is top or left, `-1` is center and `-2` is right or bottom, as shown in this illustration:

    (0, 0)----(-1, 0)----(-2, 0)
      |          |          |
      |          |          |
    (0,-1)----(-1,-1)----(-2,-1)
      |          |          |
      |          |          |
    (0,-2)----(-1,-2)----(-2,-2)

Here is an example to make this clear. Suppose that you have an image called `main.png` that you use for the main window:

    base = main, -1, -1

MPlayer tries to load `main`, `main.png`, `main.PNG` files.

### D.2.1. Main window and playbar

Below is the list of entries that can be used in the '`window = main`' ... '`end`', and the '`window = playbar`' ... '`end`' blocks.

`base = image, X, Y`

  Lets you specify the background image to be used for the main window. The window will appear at the given `X,Y` position on the screen The window will have the size of the image.

  ### Note

  These coordinates do not currently work for the display window.

  ### Warning

  Transparent regions in the image (colored #FF00FF) appear black on X servers without the XShape extension. The image's width must be dividable by 8.

`button = image, X, Y, width, height, message`

  Place a button of `width` * `height` size at position `X,Y`. The specified `message` is generated when the button is clicked. The image given by `image` must have three parts below each other (according to the possible states of the button), like this:

      +------------+
      |  pressed   |
      +------------+
      |  released  |
      +------------+
      |  disabled  |
      +------------+

`decoration = enable|disable`

  Enable or disable window manager decoration of the main window. Default is disable.

  ### Note

  This doesn't work for the display window, there is no need to.

`hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message`

`vpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message`

  Place a horizontal (hpotmeter) or vertical (vpotmeter) potmeter of `width` * `height` size at position `X,Y`. The image can be divided into different parts for the different phases of the potmeter (for example, you can have a pot for volume control that turns from green to red while its value changes from the minimum to the maximum.). `hpotmeter` can have a button that can be dragged horizontally. The parameters are:

  - `button` - the image to be used for the button (must have three parts below each other, like in case of button)

  - `bwidth`, `bheight` - size of the button

  - `phases` - the image to be used for the different phases of the hpotmeter. A special value of `NULL` can be used if you want no such image. The image must be divided into `numphases` parts vertically like this:

        +------------+
        |  phase #1  |
        +------------+
        |  phase #2  |
        +------------+
             ...
        +------------+
        |  phase #n  |
        +------------+

  - `numphases` - number of phases stored in the `phases` image

  - `default` - default value for hpotmeter (in the range `0` to `100`)

  - `X`, `Y` - position for the hpotmeter

  - `width`, `height` - width and height of the `hpotmeter`

  - `message` - the message to be generated when the value of `hpotmeter` is changed

`potmeter = phases, numphases, default, X, Y, width, height, message`

  A `hpotmeter` without a button. (I guess it is meant to be turned around, but it reacts to horizontal dragging only.) For the description of the parameters see hpotmeter. `phases` can be `NULL`, but it is quite useless, since you cannot see where the `potmeter` is set.

`font = fontfile, fontid`

  Defines a font. `fontfile` is the name of a font description file with a `.fnt` extension (do not specify the extension here). `fontid` is used to refer to the font (see dlabel and slabel). Up to 25 fonts can be defined.

`slabel = X, Y, fontid, "text"`

  Place a static label at the position `X,Y`. `text` is displayed using the font identified by `fontid`. The text is just a raw string (`$x` variables do not work) that must be enclosed between double quotes (but the " character cannot be part of the text). The label is displayed using the font identified by `fontid`.

`dlabel = X, Y, length, align, fontid, "text"`

  Place a dynamic label at the position `X,Y`. The label is called dynamic because its text is refreshed periodically. The maximum length of the label is given by `length` (its height is the height of a character). If the text to be displayed is wider than that, it will be scrolled, otherwise it is aligned within the specified space by the value of the `align` parameter: `0` is for right, `1` is for center, `2` is for left.

  The text to be displayed is given by `text`: It must be written between double quotes (but the " character cannot be part of the text). The label is displayed using the font identified by `fontid`. You can use the following variables in the text:

  Variable | Meaning
  --- | ---
  $1 | play time in hh:mm:ss format
  $2 | play time in mmmm:ss format
  $3 | play time in hh format (hours)
  $4 | play time in mm format (minutes)
  $5 | play time in ss format (seconds)
  $6 | movie length in hh:mm:ss format
  $7 | movie length in mmmm:ss format
  $8 | play time in h:mm:ss format
  $v | volume in xxx.xx% format
  $V | volume in xxx.xx format
  $b | balance in xxx.xx% format
  $B | balance in xxx.xx format
  $$ | the $ character
  $a | a character according to the audio type (none: `n`, mono: `m`, stereo: `t`)
  $t | track number (in playlist)
  $o | filename
  $f | filename in lower case
  $F | filename in upper case
  $T | a character according to the stream type (file: `f`, Video CD: `v`, DVD: `d`, URL: `u`)
  $p | the p character (if a movie is playing and the font has the p character)
  $s | the s character (if the movie is stopped and the font has the s character)
  $e | the e character (if playback is paused and the font has the e character)
  $x | movie width
  $y | movie height
  $C | name of the codec used

### Note

The `$a, $T, $p, $s` and `$e` variables all return characters that should be displayed as special symbols (for example, e is for the pause symbol that usually looks something like ||). You should have a font for normal characters and a different font for symbols. See the section about symbols for more information.

### D.2.2. Subwindow

The following entries can be used in the '`window = sub`' . . . '`end`' block.

`base = image, X, Y, width, height`

  The image to be displayed in the window. The window will appear at the given `X,Y` position on the screen (`0,0` is the top left corner). You can specify `-1` for center and `-2` for right (`X`) and bottom (`Y`). The window will be as large as the image. `width` and `height` denote the size of the window; they are optional (if they are missing, the window is the same size as the image).

`background = R, G, B`

  Lets you set the background color. It is useful if the image is smaller than the window. `R`, `G` and `B` specifies the red, green and blue component of the color (each of them is a decimal number from 0 to 255).

### D.2.3. Skin menu

As mentioned earlier, the menu is displayed using two images. Normal menu entries are taken from the image specified by the `base` item, while the currently selected entry is taken from the image specified by the `selected` item. You must define the position and size of each menu entry through the menu item.

The following entries can be used in the '`window = menu`'. . .'`end`' block.

`base = image`

  The image for normal menu entries.

`selected = image`

  The image showing the menu with all entries selected.

`menu = X, Y, width, height, message`

  Defines the `X,Y` position and the size of a menu entry in the image. `message` is the message to be generated when the mouse button is released over the entry.

Prev | Up | Next
D.1. Overview | Home | D.3. Fonts