update i3, vim ignore, bashrc everything
[dotfiles.git] / i3 / bar
diff --git a/i3/bar b/i3/bar
index fe1c8d0..fe35e72 100755 (executable)
--- a/i3/bar
+++ b/i3/bar
@@ -1,6 +1,18 @@
 #!/bin/bash
+item(){
+       echo "{\"full_text\": \"$1\"}$2"
+}
+
+battery(){
+       path=/sys/class/power_supply
+       now=$(($(cat "$path/BAT0/charge_now")*100/$(cat "$path/BAT0/charge_full")))%
+       [ "$(cat "$path/ADP1/online")" -eq "1" ] && charge="(C)"
+       [ "$now" = "100%" ] && now="FULL"
+       echo -n "$now$charge"
+}
+
 while true;
 do
-       date
+       echo "$(battery) | $(date +%x\ %X)"
        sleep 1
 done