#!/bin/sh ### Created by Amdac @ www.amdac.net ### This script was written to populate the status bar in spectrwm ### OpenBSD version vol() { mute=$(sndioctl -n output.mute) if [ $mute = "1" ]; then echo "VOL: [mute]" else volume=$(sndioctl -n output.level | sed 's/\.// ; s/^0*//') [[ -n $volume ]] || volume=0 echo "VOL: [$((${volume} /10))%]" fi } mem() { memused=$(top -d 1 | awk '/^Memory/ {print $3}' | sed 's/M\/.*//') echo "MEM: [$memused MB]" } temp() { zone0="$(sysctl hw.sensors.cpu0.temp0 | sed 's/.*=// ; s/\..*/C/')" echo "TEMP: [$zone0]" } bat() { level="$(apm | awk '/^Battery/ {print $4}')" charging="$(apm | awk '/^A\/C/ {print $4}')" [[ $charging = "not" ]] && echo "BAT: ${level}[v]" || echo "BAT: ${level}[^]" } dte() { dte=$(date +'%a %b %d [%R]') echo $dte } while (true); do echo "$(mem)+7<+@fg=0;$(temp)+7<+@fg=1;$(bat)+7<+@fg=0;$(vol)+7<+@fg=1;$(dte)+2<" sleep 2 done