Chapter 7. The Pekwm Common Syntax for Config Files

Table of Contents
7.1. Basic Syntax
7.2. Template Syntax
7.3. Variables In Pekwm Config Files

7.1. Basic Syntax

All pekwm config files (with the exception of the start file- see start file ) follow a common syntax for options.

# comment
// another comment
/*
	yet another comment
*/

$VARIABLE = "Value"
$_ENVIRONMENT_VARIABLE = "Value"
INCLUDE = "another_configuration.cfg"
COMMAND = "program to execute and add the valid config syntax it outputs here"

# Normal format
Section = "Name" {
	Event = "Param" {
		Actions = "action parameter; action parameter; $VAR $_VARIABLE"
	}
}

// Compressed format
Section = "Name" { Event = "Param" { Actions = "action parameters; action parameters; $VAR $_VARIABLE" } }

You can usually modify the spacing and line breaks, but this is the "Correct" format, so the documentation will try to stick to it.

Events can be combined into the same line by issuing a semicolon between them. Actions can be combined into the same user action by issuing a semicolon between them. You can use an INCLUDE anywhere in the file.

Pekwm has a vars file to set common variables between config files. Variables are defined in vars and the file is INCLUDEd from the configuration files.

Comments are allowed in all config files, by starting a comment line with # or //, or enclosing the comments inside /* and */.

7.2. Template Syntax

The pekwm configuration parser supports the use of templates to reduce typing. Template support is currently available in autoproperties and theme configuration files. Template configuration is not fully compatible with the non-template syntax and thus requires activation to not break backwards compatibility. To enable template parsing start the configuration file with the following:

Require {
	Templates = "True"
}

Defining templates is just like creating an ordinary section, but uses the special name Define. Below is an example defining a template named NAME:

Define = "NAME" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Value"
}

The above defined template can later be used by using the magic character @. The below example shows usage of the template NAME in a two sections named Name and NameOverride overriding one of the template values:

Section = "Name" {
  @NAME
}
Section = "NameOverride" {
  @NAME
  Value = "Overridden value"
}

The above example is equivalent of writing the following:

Section = "Name" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Value"
}
Section = "Name" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Overridden"
}

7.3. Variables In Pekwm Config Files

Pekwm config enables you to use both internal to pekwm variables, as well as global system variables. Internal variables are prefixed with a $, global variables with $_.

# examples of how to set both type of variables
$INTERNAL = "this is an internal variable"
$_GLOBAL = "this is a global variable"

# examples of how to read both type of variables
RootMenu = "Menu" {
	Entry = "$_GLOBAL" { Actions = "xmessage $INTERNAL" }
}

There is one special global variable pekwm handles. It is called $_PEKWM_CONFIG_FILE. This global variable is read when pekwm starts, and it's contents will be used as the default config file. It will also be updated to point to the currently active config file if needed.

Variables can probably be defined almost anywhere, but it's probably a better idea to place them at the top of the file, outside of any sections.