diff --git a/docs/modules/Custom.md b/docs/modules/Custom.md index 04c0f07..9b1b28d 100644 --- a/docs/modules/Custom.md +++ b/docs/modules/Custom.md @@ -1,5 +1,5 @@ Allows you to compose custom modules consisting of multiple widgets, including popups. -Buttons can interact with the bar or execute commands on click. +Labels can display dynamic content from scripts, and buttons can interact with the bar or execute commands on click. ![Custom module with a button on the bar, and the popup open. The popup contains a header, shutdown button and restart button.](https://user-images.githubusercontent.com/5057870/196058785-042ef171-7e77-4d5c-921a-eca03c6424bd.png) @@ -24,10 +24,23 @@ It is well worth looking at the examples. | `name` | `string` | `null` | Widget name. | | `class` | `string` | `null` | Widget class name. | | `label` | `string` | `null` | [`label` and `button`] Widget text label. Pango markup supported. | -| `exec` | `string` | `null` | [`button`] Command to execute. More on this [below](#commands). | +| `on_click` | `string` | `null` | [`button`] Command to execute. More on this [below](#commands). | | `orientation` | `horizontal` or `vertical` | `horizontal` | [`box`] Whether child widgets should be horizontally or vertically added. | | `widgets` | `Widget[]` | `[]` | [`box`] List of widgets to add to this box. | +### Labels + +Labels can interpolate text from scripts to dynamically show content. +This can be done by including scripts in `{{double braces}}` using the shorthand script syntax. + +For example, the following label would output your system uptime, updated every 30 seconds. + +``` +Uptime: {{30000:uptime -p | cut -d ' ' -f2-}} +``` + +Both polling and watching mode are supported. For more information on script syntax, see [here](script). + ### Commands Buttons can execute commands that interact with the bar, @@ -35,7 +48,7 @@ as well as any arbitrary shell command. To execute shell commands, prefix them with an `!`. For example, if you want to run `~/.local/bin/my-script.sh` on click, -you'd set `exec` to `!~/.local/bin/my-script.sh`. +you'd set `on_click` to `!~/.local/bin/my-script.sh`. The following bar commands are supported: @@ -44,7 +57,7 @@ The following bar commands are supported: - `popup:close` XML is arguably better-suited and easier to read for this sort of markup, -but currently not supported. +but currently is not supported. Nonetheless, it may be worth comparing the examples to the below equivalent to help get your head around what's going on: @@ -53,15 +66,16 @@ to help get your head around what's going on: -