funstats (674B)
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 ] || [ "$(sndioctl -n input.mute)" -eq 1 ]; then 14 printf "muted" 15 else 16 sndioctl -n input.level | awk '{ printf "%d%%\n", int($0*100) }' 17 fi 18 } 19 20 bat () { 21 apm -l 22 } 23 24 lidaction () { 25 [ "$(sysctl -n machdep.lidaction)" -eq 1 ] && printf "on" || printf "off" 26 } 27 28 temp () { 29 sysctl -n hw.sensors.cpu0.temp0 | awk '{ print $1, "C" }' 30 } 31 32 echo "|mic: $(mic)|vol: $(vol)|bat: $(bat)%|temp: $(temp)|lid: $(lidaction)|"