~spxtr/hstatus

Simple status line generator for the likes of i3bar.
Exhaustive switch.
Make it work with stdlib changes.

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~spxtr/hstatus
read/write
git@git.sr.ht:~spxtr/hstatus

You can also use your local clone with git send-email.

#hstatus

A simple status line generator, for feeding into the likes of i3bar or swaybar.

Build with hare build. Run with ./hstatus -c path_to_config.ini. If you do not a config path with -c, it will look in $XDG_CONFIG_HOME/hstatus/config.ini.

#Configuration

config.ini must have sections of the form

[section-name]
command=some command to pass to sh -c
interval=time in seconds

Each command is run once at program start, and then at most once every specified interval. No time intervals shorter than one second will be respected. For each invocation, stdout is captured and saved. When any changes to stdout are detected, the program prints out a new line with all captured outputs separated by a delimiter, typically " | ".

Optionally, include prefix or postfix keys. A space will be included between the prefix and the result value, but not between the value and the postfix.

A typical example would be:

[cpu-usage]
prefix=CPU:
command=mpstat 1 5 --dec=1 | awk 'END{print 100-$NF"%"}'
interval=10

[cpu-temp]
prefix=CPU:
command=sensors | grep Tctl | cut -d " " -f 10 | cut -c 2-
interval=10

[updates]
prefix=Updates:
command=checkupdates | wc -l
interval=3600

[time]
command=date +"%Y-%m-%d %H:%M"
interval=5

A typical output for this config will be

CPU: 31.5% | CPU: 62.6°C | Updates: 1 | 2023-03-21 15:01

#TODO

  • Configurable delimiter.
  • Colors, JSON.
  • Update signals.