funstats (676B)
1 #!/bin/sh 2 # some cool stats for the tmux bar on openbsd 3 4 vol () { 5 if [ "$(sndioctl -n output.mute)" -eq 1 ]; then 6 echo "muted" 7 else 8 sndioctl -n output.level | awk '{ printf "%d%%\n", int($0*100) }' 9 fi 10 } 11 12 mic () { 13 if [ "$(sysctl -n kern.audio.record)" -eq 1 ] || 14 [ "$(sndioctl -n input.mute)" -eq 1 ]; then 15 printf "muted" 16 else 17 sndioctl -n input.level | awk '{ printf "%d%%\n", int($0*100) }' 18 fi 19 } 20 21 bat () { 22 apm -l 23 } 24 25 lidaction () { 26 [ "$(sysctl -n machdep.lidaction)" -eq 1 ] && printf "on" || printf "off" 27 } 28 29 temp () { 30 sysctl -n hw.sensors.cpu0.temp0 | awk '{ print $1, "C" }' 31 } 32 33 echo "|mic: $(mic)|vol: $(vol)|bat: $(bat)%|temp: $(temp)|lid: $(lidaction)|"