Module
A module lets you apply your theme to a specific program or part of your system (like a bar, terminal, browser...). Modules use the theme_dict
to generate config files, run shell commands, or execute Python hooks. You can create your own modules or use starter modules from the community.
On this page:
What is a module?
A module receives a module-specific theme_dict
(see style for more info) and applies the theme through:
It is configured using a module.yaml
file located in PIMP_CONFIG_DIR/modules/MODULE_NAME/
.
Module YAML structure
Here's an example:
Every action in run
will be executed sequentially, stopping on error.
run
file
Use file
to generate a file from a Jinja template using the theme_dict
. You can also use values from the theme_dict
in the file path.
This will generate a file from the template and save it to the target path, overwriting the existing file.
You can also:
For advanced usage see the Jinja docs or the starter modules for some examples.
shell
Use shell
to run shell commands.
You can also:
python
Use python
to execute a Python function.
The function will receive the theme_dict
as an argument and must be async
.
enabled
Use enabled
to activate or deactivate the module.
os
Defines the operating systems where this module should be executed. If the current OS is not listed, the module is ignored.
init
A list of actions that are executed when the module is installed or reinitialized.
link
Use this to link files or directories. The source should be located under ../MODULE_NAME/files/
(eg: ../MODULE_NAME/files/FlatColor
)
pre_run
These actions run before run
.
python
Use this to modify the theme_dict
before any run
actions are executed. This allows you to dynamically adjust theme values based on conditions or computations.
The Python function must be async
, will receive the theme_dict
as an argument and must return it.
commands
Define custom commands that can be invoked independently via the CLI. Useful for utility commands, debugging, or providing module-specific tools.
python
The function receives an instance of ThemeManager
and must be async.
You will then be able to run it with: