updated ps1 without newline, vimrc for bashrc and xresources and better color scheme
[dotfiles.git] / i3 / bar
diff --git a/i3/bar b/i3/bar
index 24b05f3..615a111 100755 (executable)
--- a/i3/bar
+++ b/i3/bar
@@ -1,35 +1,25 @@
 #!/bin/bash
-function music {
-       song=$([ "$(mpc | wc -l)" = "1" ] && echo "[stopped]" || echo $(mpc | head -1))
-       status=$(mpc | grep -o "\[p.*\]")
-       echo -ne "♪: $song$status | "
+item(){
+       echo "{\"full_text\": \"$1\"}$2"
 }
 
-function net {
-       cat /run/network/ifstate | grep -q $1 && echo "$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"
 }
 
-function volume {
-       volume=$(amixer | grep -A4 Master | grep -o "[0-9]\{1,3\}%\|\[off\]")
-       echo -ne "♬: $volume | "
+volume(){
+       mixer=$(amixer | head -5 | tail -1)
+       echo $mixer | grep "\[on\]" && mute="(M)"
+       volume=$(echo $mixer | grep -Po "(?<=\[)[0-9]{1,3}%")
+       echo -n "vol: $volume$mute"
 }
 
-function temp {
-       temp=$(sensors|grep temp1|head -1|awk '{print $2}')
-       echo -ne "⚠: $temp | "
-}
-
-function battery {
-       pa="/sys/class/power_supply/BAT0"
-       power=$(echo "$(cat $pa/charge_now)*100/$(cat $pa/charge_full)" | bc)
-       charge=""
-       if [ "$(cat $pa/status)" = "Charging" ]; then
-               charge="(C)"
-       fi
-       echo -ne "⚡: $power%$charge | "
-}
-
-while [ 1 ]; do
-       echo "$(music)$(volume)$(net wlan0 W)$(net eth0 E)$(net usb0 U)$(temp)$(battery)$(date +%y-%m-%d\ %H:%M)"
-       sleep 5
+while true;
+do
+       echo "$(volume) | $(battery) | $(date +%x\ %X)"
+       sleep 1
 done