Multiple battieries in i3blocks
My T440 has both an internal and an external battery. I did not find an existing solution to my needs, so I came up with my own.
1. Script
The "don't ask questions' one-liner. Maybe it works for you too.
#!/bin/bash acpi -b | gawk 'match($0, /([0-9]+)%/, a) { printf(" <span color=\"#50e682\">🔋</span> %i <span color=\"#50e682\">%</span> ", a[1])}' | rev | cut -c1- | rev
2. Example Output
The HTML to display all batteries (in this case two). Now it would be cool to use the appropriate emoji for each battery state, but that is probably hard to integrate into the pipe line.
$ chmod +x ./battery $ ./battery <span color="#50e682">🔋</span> 99 <span color="#50e682">%</span> <span color="#50e682">🔋</span> 98 <span color="#50e682">%</span>
3. Configuring i3blocks
Adding a small section to display the script output.
[battery] command=~/.config/i3blocks/battery interval=2 border=#50e682 border_top=1 border_right=0 border_bottom=0 border_left=0