As is always the case, there are quite a few applications that share a same set of properties. For example, we want to have uniform looks for Qt and GTK applications. Templating utility is developed under the DRY (Don't Repeat Yourself) principle, it allows to manage these shared properties in one place: change once, apply everywhere.



To manage shared properties, add a section [context] to dt-cli's config file. For example, to set a property named cursor-size for the gui group to value 24:

# ~/.config/dt/cli.toml
gui.cursor-size = 24
## Or, as TOML allows it:
#cursor-size = 24

See the configuration guide for detailed usages.


dt-cli uses Rust's Handlebars crate to render templates. Handlebars is tested and widely used, according to its descriptions:


Handlebars-rust is the template engine that renders the official Rust website rust-lang.org.

For example, to apply a property named cursor-size to all source files under the gui group:

gtk-cursor-theme-size={{{ gui.cursor-size }}}

With context.gui.cursor-size being set to 24 (as in previous section), the above template (in a group with name gui) will be rendered as:

# ~/.config/gtk-3.0/settings.ini


The time consumed while rendering can be quite noticeable if the template being rendered is huge. To skip rendering for a group, use the renderable = false option in the config file.

The Handlebars crate also allows syntaxes like looping and conditioning, the built-in helpers are understood in dt-cli's templates. Please refer to the Handlebars crate's page for syntax guides.