1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 11:24:24 +02:00
ironbar/docs/modules/Script.md
Jake Stanger dea66415c2
feat: module-level name and class options
BREAKING CHANGE: To allow for the `name` property, any widgets that were previously targeted by name should be targeted by class instead. This affects **all modules and all popups**, as well as several widgets inside modules. **This will break a lot of rules in your stylesheet**. To attempt to mitigate the damage, a migration script can be found [here](https://raw.githubusercontent.com/JakeStanger/ironbar/master/scripts/migrate-styles.sh) that should get you most of the way.

Resolves #75.
2023-05-06 13:22:35 +01:00

2 KiB

Executes a script and shows the result of stdout on a label. Pango markup is supported.

Configuration

Type: script

Name Type Default Description
cmd string null Path to the script on disk
mode 'poll' or 'watch' poll See #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.
JSON
{
  "end": [
    {
      "type": "script",
      "cmd": "/home/jake/.local/bin/phone-battery",
      "mode": "poll",
      "interval": 5000
    }
  ]
}

TOML
[[end]]
type = "script"
cmd = "/home/jake/.local/bin/phone-battery"
mode = "poll"
interval = 5000
YAML
end:
  - type: "script"
    cmd: "/home/jake/.local/bin/phone-battery"
    mode: 'poll'
    interval : 5000
Corn
{
  end = [
    {
      type = "script"
      cmd = "/home/jake/.local/bin/phone-battery"
      mode = "poll"
      interval = 5000
    }
  ]
}

Styling

Selector Description
.script Script widget label

For more information on styling, please see the styling guide.