i3blocks
i3blocks copied to clipboard
Battery regex in example doesn't handle 100%
Regex should be changed to support one to three digits number.
BAT=$(acpi -b | grep -E -o '[0-9][0-9]?[0-9]?%')
BAT=$(acpi -b | grep -E -o '[0-9][0-9]?[0-9]?%')
Oh, true. I guess the following is even more appropriate.
BAT=$(acpi -b | grep -E -o '[0-9]{1,3}%')
However, I do not recall il the braces should be escaped.
if acpi isn't installed the battery charge can be found using
grep -P -o '(?<=^POWER_SUPPLY_CAPACITY=)\w*$' /sys/class/power_supply/BAT0/uevent