i3blocks

i3blocks is a command-line utility which executes commands and generates an output understood by status bars. I like to think of i3blocks as a wrapper, or a second configuration for i3bar and swaybar.

The configuration file for i3blocks is located in ~/.config/i3blocks/config – it's in the INI format an the components of the status bar should all have their own sections.

This command retrieves the private IPv4 address:

hostname -i | awk '{ print $1 }'

This command retrieves the battery capacity:

upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -m1 -oE '[0-9]{1,3}?%'

This command retrieves the date and time:

date +'%b %d %H:%M'

This command retrieves the SSID of the local network:

iw dev wlan0 info | grep ssid | awk '{ print $2 }'

Assemble everything together:

# [ssid]
# command=iw dev wlan0 info | grep ssid | awk '{ print $2 }'
# interval=60

# [ip]
# command=hostname -i | awk '{ print $1 }'
# interval=60

[battery]
command=upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -m1 -oE '[0-9]{1,3}?%'
interval=30

[time]
command=date +'%b %d %H:%M'
interval=5