feat: dynamic tooltips

Resolves #36
This commit is contained in:
Jake Stanger
2022-11-30 22:27:56 +00:00
parent 1320639d4e
commit d20972cb32
7 changed files with 79 additions and 36 deletions

View File

@@ -279,10 +279,10 @@ The following table lists each of the top-level bar config options:
The following table lists each of the module-level options that are present on **all** modules.
For details on available modules and each of their config options, check the sidebar.
For information on the `Script` type, see [here](script).
For information on the `Script` type, and embedding scripts in strings, see [here](script).
| Name | Type | Default | Description |
|------------|--------------------|---------|--------------------------------------------------------------------------------------------------------------------|
| `show_if` | `Script [polling]` | `null` | Polls the script to check its exit code. If exit code is zero, the module is shown. For other codes, it is hidden. |
| `on_click` | `Script [polling]` | `null` | Runs the script when the module is clicked. |
| `tooltip` | `string` | `null` | Shows this text on hover. |
| `tooltip` | `string` | `null` | Shows this text on hover. Supports embedding scripts between `{{double braces}}`. |

View File

@@ -42,6 +42,17 @@ For example:
poll:5000:uptime -p | cut -d ' ' -f2-
```
#### Embedding
Some string config options support "embedding scripts". This allows you to mix static/dynamic content.
An example of this is the common `tooltip` option.
Scripts can be embedded in these cases using `{{double braces}}` and the shorthand syntax:
```json
"Up: {{30000:uptime -p | cut -d ' ' -f2-}}"
```
### Longhand (object)
An object consisting of the `cmd` key and optionally the `mode` and/or `interval` keys.