X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=i3%2Fbar;h=615a11154af3678d28727196f083d35ee5460a55;hb=d7974f44289f5483e6eeb81e5c6ae20991943dfb;hp=867821a539bf4ff86d19ec213e599b8e555a3673;hpb=25a333e8dbc9407e9739ba5e0cbe2d61f07cb970;p=dotfiles.git diff --git a/i3/bar b/i3/bar index 867821a..615a111 100755 --- 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 | " -#} - -function net { - grep -q "$1" /run/network/ifstate && echo "$2 | " -} - -function volume { - volume=$(amixer | grep -A4 Master | grep -o "[0-9]\{1,3\}%\|\[off\]") - echo -ne "♬: $volume | " +item(){ + echo "{\"full_text\": \"$1\"}$2" } -function temp { - temp=$(sensors|grep temp1|head -1|awk '{print $2}') - echo -ne "⚠: $temp | " +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 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 | " +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" } -while [ 1 ]; do - echo "$(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