fe35e720f3554773453bb9a71b929987d4c46d5f
[dotfiles.git] / i3 / bar
1 #!/bin/bash
2 item(){
3 echo "{\"full_text\": \"$1\"}$2"
4 }
5
6 battery(){
7 path=/sys/class/power_supply
8 now=$(($(cat "$path/BAT0/charge_now")*100/$(cat "$path/BAT0/charge_full")))%
9 [ "$(cat "$path/ADP1/online")" -eq "1" ] && charge="(C)"
10 [ "$now" = "100%" ] && now="FULL"
11 echo -n "$now$charge"
12 }
13
14 while true;
15 do
16 echo "$(battery) | $(date +%x\ %X)"
17 sleep 1
18 done