dotfiles

Dotfiles for my OpenBSD environment.
git clone https://git.mtkn.jp/dotfiles
Log | Files | Refs

dwm_status (828B)


      1 #!/bin/sh
      2 date="$(date '+%m/%d %a %H:%M') |"
      3 
      4 mute=$(sndioctl -n output.mute)
      5 [ "$mute" = 1 ] && state="MUTE" || state="VOL"
      6 volume=$(printf '%.0f' $(echo $(sndioctl -n output.level) '*' 100 | bc))
      7 volume=" $state $volume |"
      8 
      9 online=$(apm -a)
     10 capacity=$(apm -l)
     11 if [ "$online" = "1" ]; then
     12 	bat=" AC $capacity |"
     13 elif [ "$online" = "0" ]; then
     14 	bat=" BAT $capacity |"
     15 else
     16 	bat=""
     17 fi
     18 
     19 cpu=" CPU $(uptime | sed 's/.*load averages: \(.*\)/\1/' | cut -d, -f1) "$(printf "%4s" "$(sysctl -n hw.cpuspeed)")"MHz |"
     20 
     21 tmp=" TMP $(sysctl -n hw.sensors.cpu0.temp0 | cut -d'.' -f1) |"
     22 
     23 eth=$(ifconfig em0 | awk '/active/{printf "ETH "}')
     24 wifi=$(ifconfig iwn0 | awk '/active/{printf "WIFI "}/no network/{printf "down:"}/join/{printf "%s %s\n", $3, $8}')
     25 nw=" $eth$wifi"
     26 
     27 printf "%s%s%s%s%s%s\n" "$date" "$volume" "$bat" "$cpu" "$tmp" "$nw"