X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=i3%2Fbar;h=5ae1bace5e707f12402d74c40394498e1aed6391;hb=159915cd7d8d22af8f27c7bc735079c4347877b2;hp=cdebaf874829c9485cd82123078c9e0b88096330;hpb=2a8eabb8186791663e2aa8a57c3400eb91f2fa75;p=dotfiles.git diff --git a/i3/bar b/i3/bar index cdebaf8..5ae1bac 100755 --- a/i3/bar +++ b/i3/bar @@ -1,29 +1,25 @@ #!/bin/bash -function net { - grep -q "$1" /run/network/ifstate && echo "$2 <$(iwconfig "$1" 2>/dev/null | grep -Po "(?<=ESSID:\").*(?=\")")> | " +item(){ + echo "{\"full_text\": \"$1\"}$2" } -function volume { - volume=$(amixer | grep -A4 Master | grep -o "[0-9]\{1,3\}%\|\[off\]") - echo -ne "♬: $volume | " +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 temp { - temp=$(sensors|grep temp1|head -1|awk '{print $2}') - echo -ne "⚠: $temp | " +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 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 "$(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