2022-11-07 01:52:21 +03:00
|
|
|
Executes a script and shows the result of `stdout` on a label.
|
|
|
|
Pango markup is supported.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
> Type: `script`
|
|
|
|
|
2022-11-07 02:04:24 +03:00
|
|
|
| Name | Type | Default | Description |
|
|
|
|
|------------|-----------------------|---------|---------------------------------------------------------|
|
2022-11-29 01:25:14 +03:00
|
|
|
| `cmd` | `string` | `null` | Path to the script on disk |
|
2022-11-07 02:04:24 +03:00
|
|
|
| `mode` | `'poll'` or `'watch'` | `poll` | See [#modes](#modes) |
|
|
|
|
| `interval` | `number` | `5000` | Number of milliseconds to wait between executing script |
|
|
|
|
|
|
|
|
### Modes
|
|
|
|
|
|
|
|
- Use `poll` to run the script wait for it to exit. On exit, the label is updated to show everything the script wrote to `stdout`.
|
|
|
|
- Use `watch` to start a long-running script. Every time the script writes to `stdout`, the label is updated to show the latest line.
|
|
|
|
Note this does not work for all programs as they may use block-buffering instead of line-buffering when they detect output being piped.
|
2022-11-07 01:52:21 +03:00
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>JSON</summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"end": [
|
|
|
|
{
|
|
|
|
"type": "script",
|
2022-11-29 01:25:14 +03:00
|
|
|
"cmd": "/home/jake/.local/bin/phone-battery",
|
2022-11-07 02:04:24 +03:00
|
|
|
"mode": "poll",
|
2022-11-07 01:52:21 +03:00
|
|
|
"interval": 5000
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>TOML</summary>
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[[end]]
|
|
|
|
type = "script"
|
2022-11-29 01:25:14 +03:00
|
|
|
cmd = "/home/jake/.local/bin/phone-battery"
|
2022-11-07 02:04:24 +03:00
|
|
|
mode = "poll"
|
2022-11-07 01:52:21 +03:00
|
|
|
interval = 5000
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>YAML</summary>
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
end:
|
|
|
|
- type: "script"
|
2022-11-29 01:25:14 +03:00
|
|
|
cmd: "/home/jake/.local/bin/phone-battery"
|
2022-11-07 02:04:24 +03:00
|
|
|
mode: 'poll'
|
2022-11-07 01:52:21 +03:00
|
|
|
interval : 5000
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>Corn</summary>
|
|
|
|
|
|
|
|
```corn
|
|
|
|
{
|
|
|
|
end = [
|
|
|
|
{
|
|
|
|
type = "script"
|
2022-11-29 01:25:14 +03:00
|
|
|
cmd = "/home/jake/.local/bin/phone-battery"
|
2022-11-07 02:04:24 +03:00
|
|
|
mode = "poll"
|
2022-11-07 01:52:21 +03:00
|
|
|
interval = 5000
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
## Styling
|
|
|
|
|
|
|
|
| Selector | Description |
|
|
|
|
|---------------|---------------------|
|
|
|
|
| `#script` | Script widget label |
|