Module corky.config
Functions dealing with the configuration file.
This module provides a function to read the configuration file (usually Conky's configuration file) and call registered functions of other modules to process the configuration directives.
For Corky, all configuration directives may be included in Conky's configuration file, though parsing other files is supported.
A directive always starts with the characters "#:"
(without quotes), which must be the first non-whitespace
characters on a line, and continues until the end of the line (a directive may not span multiple lines). The
"#:"
must then be followed by a keyword and zero or more parameters. Whitespace characters before (and after)
the keyword are allowed. Keyword and parameters have to be separated by commas, i.e. there must be a comma
between the keyword and the first parameter and before any subsequent parameters. A configuration directive
looks like this (brackets denote optional parameters):
#: <keyword>[, <parameter>[, <parameter> […]]]
If a parameter contains a comma, the parameter must be quoted using "
. Quotes may be included inside a quoted
parameter string by escaping them with another quote (i.e. "
becomes ""
inside a quoted string). Whitespace
at the beginning or end of a parameter will be removed, to preserve all whitespace, quotes may be used (any
whitespace around the quoted string will still be removed). Empty parameters are allowed.
All lines in the file that do not match the format described above will be ignored! See the individual modules for a description of their configuration options.
Note: Configuration files are parsed as text files, so Corky is compatible with Conky configuration files for versions before 1.10 (using the old configuration style), and with configuration files for version 1.10 and later. Starting with version 1.10 Conky uses a Lua file for its configuration. Since Corky's configuration is not valid Lua, it has to be included in a multi-line Lua comment (or more then one multiline comment, Corky doesn't care, as long as the configuration matches the syntax described above). For example:
--[[
This is a Lua comment. Corky configuration follows:
#: some, config, options
--]]
Info:
Functions
handler (keyword, func) | Register a configuration handler. |
read ([file]) | Process the configuration file. |
Local Tables
handlers | Stores the configuration handlers for the keywords. |
Functions
- handler (keyword, func) line 91
-
Register a configuration handler.
A configuration handler is responsible for processing a (pre-processed) configuration directive. For all directives found in the configuration file the assigned handler will be called. It will be called with one parameter: a table (array) containing the keyword and all parameters, in the order specified in the config file. The handler must return either
true
if the configuration directive is valid, orfalse
if there is something wrong with it (if there is something wrong the directive should be ignored by the handler).Parameters:
- keyword string The keyword in the configuration file that will trigger the handler.
- func function The function that will process the configuration directive.
- read ([file]) line 111
-
Process the configuration file.
The specified configuration file will be parsed according to the rules mentioned above. Errors will cause warning messages to be printed to
STDERR
. The actual processing of the options is done by the registered handlers, see handler(). If no configuration file is specified,conky_config
will be used.Parameters:
- file
string
Path of the configuration file. Defaults to
conky_config
if not specified. (optional)
- file
string
Path of the configuration file. Defaults to