feat: add battery info

This commit is contained in:
Krzysztof Rudnicki 2024-11-15 13:13:49 +01:00
parent 65a73b34c2
commit 42f582a6d3
3 changed files with 18 additions and 2 deletions

12
i3blocks/battery_status.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
acpi -b | awk -F', ' '
/Battery/ {
split($2, percent, "%")
split($3, time, " ")
printf " Battery: %d%%", percent[1]
if (time[1] != "") printf ", %s", time[1]
if ($1 ~ /Charging/) printf ", Charging"
printf "\n"
}'

View File

@ -11,7 +11,6 @@ markup=pango
command=~/.config/i3blocks/motherboard_temp.sh
interval=10
[memory]
command=free -h | awk '/^Mem:/ {print "RAM: " $3 "/" $2}' #  for RAM
interval=10
@ -30,6 +29,10 @@ interval=1
command=~/.config/i3blocks/bluetooth.sh
interval=5
[battery]
command=~/.config/i3blocks/battery_status.sh
interval=30
color=#50FA7B
[ethernet]
command=ip -o -4 addr show enp6s0 | awk '{print " LAN: "$4}' || echo " LAN: down" #  for Ethernet
@ -43,3 +46,5 @@ interval=1
command=echo " $(date '+%Y-%m-%d %H:%M')" #  for time (Font Awesome icon)
interval=1
color=#50FA7B

View File

@ -3,4 +3,3 @@ sudo pacman -S --needed ttf-dejavu noto-fonts ttf-font-awesome
cp -r i3blocks ~/.config/
cp -r i3 ~/.config/
i3-msg reload
reload