X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=x%2F.local%2Fbin%2Fbar;h=cdc09f47534ca754512209a8f03a271d26b3e66e;hb=HEAD;hp=f210c49fa92f9607cebf6866c58c2da97fcf61f3;hpb=3a92354af22bbdab45045d2acfe095d52a4eb59b;p=dotfiles.git diff --git a/x/.local/bin/bar b/x/.local/bin/bar index f210c49..cdc09f4 100755 --- a/x/.local/bin/bar +++ b/x/.local/bin/bar @@ -1,10 +1,14 @@ #!/bin/sh -for f in /sys/class/power_supply/BAT*/uevent; do - eval $(grep -v " " "$f") - bat="$bat⚡$((POWER_SUPPLY_CHARGE_NOW*100/POWER_SUPPLY_CHARGE_FULL))% ($POWER_SUPPLY_STATUS) | " -done +# battery +if stat -t /sys/class/power_supply/BAT*/uevent >/dev/null 2>&1; then + for f in /sys/class/power_supply/BAT*/uevent; do + eval $(grep -v " " "$f") + bat="$bat⚡$((POWER_SUPPLY_CHARGE_NOW*100/POWER_SUPPLY_CHARGE_FULL))% ($POWER_SUPPLY_STATUS) | " + done +fi -for int in $(ip link show | grep -Po '(?<=.: )\S+(?=:)'); do +# network adapters +for int in $(ip link show | grep -Po '(?<=.: )[A-Za-z0-9]+(?=:)' | grep -v docker); do if [ $(ip addr show dev $int | grep -Po "(?<=link/)\S+ ") = "ether" ]; then net="$net$int: " if /sbin/iwconfig $int >/dev/null 2>&1; then @@ -14,8 +18,13 @@ for int in $(ip link show | grep -Po '(?<=.: )\S+(?=:)'); do fi done +# sound levels snd="♪ $(pactl list sinks | grep -Po "(?<=Volume: front)[^%]*" | grep -o "[0-9]\?[0-9][0-9]$" | head -n 1) | " + +# disk space dsk="Dsk: $(df -h | grep '/$' | awk '{print $4"/"$2}') | " + +# date date="$(date +"%Y-%m-%d %H:%M") " echo "$net$snd$bat$dsk$date"