diff --git a/i3blocks/battery_status.sh b/i3blocks/battery_status.sh new file mode 100755 index 0000000..f126a62 --- /dev/null +++ b/i3blocks/battery_status.sh @@ -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" + }' + diff --git a/i3blocks/config b/i3blocks/config index 82b3c8f..2803e37 100644 --- a/i3blocks/config +++ b/i3blocks/config @@ -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 + + diff --git a/install.sh b/install.sh index c527d1a..d179ef3 100755 --- a/install.sh +++ b/install.sh @@ -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