X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=x%2F.local%2Fbin%2Fbar;h=33e1fa425e7b3a1cb52f9e588015687228ab2863;hb=98ef8dd720b8a4c6a3a19be3d5b4972188951967;hp=ddff365482efc21ad49d837e007390102f320f7a;hpb=7d26c31904f426d28913aed8ba7ede20fb0c496d;p=dotfiles.git diff --git a/x/.local/bin/bar b/x/.local/bin/bar index ddff365..33e1fa4 100755 --- a/x/.local/bin/bar +++ b/x/.local/bin/bar @@ -1,3 +1,21 @@ #!/bin/sh -echo -n \ - $(date +"%Y-%m-%d %H:%M:%S") +batprefix=/sys/class/power_supply/BAT0 +if [ -f $batprefix/charge_full -a -f $batprefix/charge_now ]; then + bat="$(echo $(cat $batprefix/charge_now)*100/$(cat $batprefix/charge_full) | bc)% |" +fi + +if ip -br a | grep -q '^wlp'; then + wlan="$(/sbin/iwconfig 2>/dev/null | grep -oP '(?<=ESSID:\").*(?=\")')" + if [ -z "$wlan" ]; then + wlan="Not connected |" + else + wlan="$wlan |" + fi +fi + +echo \ + "W $wlan"\ + "♪ $(pactl list sinks | grep -Po "(?<=Volume: front)[^%]*" | grep -o "100$") |"\ + "⚡$bat"\ + "Dsk: $(df -h | grep '/$' | awk '{print $4"/"$2}') |"\ + "$(date +"%Y-%m-%d %H:%M:%S")"