+++ title = "Configuration" slug = "The basics of how to configure eww" weight = 1 +++ ## Configuration For specific built in widgets `, , , etc` see [Widget Documentation](@/main/widgets.md) ### Placing the configuration file Note: Example configuration files can be found in the `examples` directory of the repository and are showcased in [Examples](@/main/examples.md). The configuration file and the scss file should lay in `$XDG_CONFIG_HOME/eww` (or, if unset, `$HOME/.config/eww`). The XML file should be named `eww.xml` and the scss should be named `eww.scss` So the directory structure should look like this: ``` $HOME └──.config ──eww ├──eww.xml └──eww.scss ``` ### Config structure Your config structure should look like this: ```xml ``` See [The `` block](#the-includes-block), [The `` block](#the-definitions-block), [Variables](#variables) and the [The `` block](#the-windows-block). ### Variables If you create a `` or a ``, you can reference them in your `` by doing `{{var}}`. Where `var` is your variable name. #### The `` tag Allows you to repeat the same text multiple times through without retyping it multiple times. Example: This will define a variable named `banana`, with the default value "I like bananas." ```xml I like bananas. ``` You can then reference it in your widgets by doing: ```xml {{banana}} ``` To change the value of the variable, and thus change the UI, you can run `eww update banana "I like apples"` #### The `` tag Allows you to create a script that eww runs. Useful for creating volume sliders or anything similar. Example: ```xml date +%H:%M ``` and then reference it by doing: ```xml {{date}} ``` The `interval="5s"` part says how long time it should take before Eww runs the command again. Here are the available times you can set: | Shortened | Full name | |-----------|-------------| | ms | Miliseconds | | s | Seconds | | m | Minutes | | h | Hours | #### Tail If you don't want a set interval and instead want it to tail (run the script when it detects a change is present) you can simply remove the `interval="5s"` so it becomes: ```xml date +%H:%M ``` ### The `` block Here you can include other config files so that they are merged together at startup. Currently namespaced variables are not supported so be careful when reusing code. ```xml ``` If you define a variable/widget/window, in a config file, when it's defined somewhere else, you can see a warning in the eww logs (`eww logs`) ### The `` block In here you whole widget will be made, and you can also create your own widgets. Check [Widget Documentation](@/main/widgets.md) for pre-defined widgets. #### Custom widgets Let's get a small config and break it down. ```xml The time is: {{my_time}} currently. date ``` That's a long config just for a custom widget. But let's break it down and try to understand it. This part: ```xml The time is: {{my_time}} currently. ``` Is the custom widget. As we can see by the ```xml ``` the widget is called `clock.`Or referenced `` The `{{my_time}}` is the value we assign to be well, our time. You can actually set to be anything, it doesn't have to be a time. You can compare it to `value=""` So if we look at: ```xml ``` we can see that we assign `{{my_time}}` to be `{{date}}` and if we look at ```xml date ``` we can see that `{{date}}` is simply running the `date` command. It doesn't have to be `{{my_time}}` either, it can be anything. ```xml The time is: {{very_long_list_of_animals}} currently. ``` is valid. To use that it would look like this: ```xml ``` ### The `` block {#windows-block} All different windows you might want to use are defined in the `` block. The `` config should look something like this: ```xml
``` The window block contains multiple elements to configure the window. - `` is used to specify the position and size of the window. - `` is used to have eww reserve space at a given side of the screen the widget is on. - `` will contain the widget that is shown in the window. There are a couple things you can optionally configure on the window itself: - `stacking`: stacking describes if the window will be shown in the foreground (in front of other windows) or in the background (behind other windows). Possible values: `"fg"`, `"bg"`. Default: `"fg"` - `focusable`: whether the window should be focusable by the windowmanager. This is necessary for things like text-input-fields to work properly. Possible values: `"true"`, `"false"`. Default: `"false"` - `screen`: Specifies on which display to show the window in a multi-monitor setup. This can be any number, representing the index of your monitor.