i3status_rs::blocks

Module custom

source
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

KeyValuesDefault
formatA string to customise the output of this block. See below for available placeholders."{ $icon|} $text.pango-str() "
commandShell command to execute & displayNone
persistentRun command in the background; update display for each output line of the commandfalse
cycleCommands to execute and change when the button is clickedNone
intervalUpdate interval in seconds (or “once” to update only once)10
jsonUse JSON from command output to format the block. If the JSON is not valid, the block will error out.false
watch_filesWatch files to trigger update on file modification. Supports path expansions e.g. ~.None
hide_when_emptyHides the block when the command output (or json text field) is emptyfalse
shellSpecify the shell to use when running commands$SHELL if set, otherwise fallback to sh
PlaceholderValueTypeUnit
iconValue of icon field from JSON output when it’s non-emptyIcon-
textOutput of the script or text field from JSON outputText
short_textshort_text field from JSON outputText
ActionDefault button
cycleLeft

§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

Structs§

Functions§