Expand description
The output of a custom shell command
For further customisation, use the json
option and have the shell command output valid JSON in the schema below:
{"icon": "...", "state": "...", "text": "...", "short_text": "..."}
icon
is optional (default “”)
state
is optional, it may be Idle, Info, Good, Warning, Critical (default Idle)
short_text
is optional.
§Configuration
Key | Values | Default |
---|---|---|
format | A string to customise the output of this block. See below for available placeholders. | "{ $icon|} $text.pango-str() " |
command | Shell command to execute & display | None |
persistent | Run command in the background; update display for each output line of the command | false |
cycle | Commands to execute and change when the button is clicked | None |
interval | Update interval in seconds (or “once” to update only once) | 10 |
json | Use JSON from command output to format the block. If the JSON is not valid, the block will error out. | false |
watch_files | Watch files to trigger update on file modification. Supports path expansions e.g. ~ . | None |
hide_when_empty | Hides the block when the command output (or json text field) is empty | false |
shell | Specify the shell to use when running commands | $SHELL if set, otherwise fallback to sh |
Placeholder | Value | Type | Unit |
---|---|---|---|
icon | Value of icon field from JSON output when it’s non-empty | Icon | - |
text | Output of the script or text field from JSON output | Text | |
short_text | short_text field from JSON output | Text |
Action | Default button |
---|---|
cycle | Left |
§Examples
Display temperature, update every 10 seconds:
[[block]]
block = "custom"
command = ''' cat /sys/class/thermal/thermal_zone0/temp | awk '{printf("%.1f\n",$1/1000)}' '''
Cycle between “ON” and “OFF”, update every 1 second, run next cycle command when block is clicked:
[[block]]
block = "custom"
cycle = ["echo ON", "echo OFF"]
interval = 1
[[block.click]]
button = "left"
action = "cycle"
Use JSON output:
[[block]]
block = "custom"
command = "echo '{\"icon\":\"weather_thunder\",\"state\":\"Critical\", \"text\": \"Danger!\"}'"
json = true
Display kernel, update the block only once:
[[block]]
block = "custom"
command = "uname -r"
interval = "once"
Display the screen brightness on an intel machine and update this only when pkill -SIGRTMIN+4 i3status-rs
is called:
[[block]]
block = "custom"
command = ''' cat /sys/class/backlight/intel_backlight/brightness | awk '{print $1}' '''
signal = 4
interval = "once"
Update block when one or more specified files are modified:
[[block]]
block = "custom"
command = "cat custom_status"
watch_files = ["custom_status"]
interval = "once"
§TODO:
- Use
shellexpand