#!/bin/bash
#
# statusbar - set up dwm statusbar
while true; do
# Load average
S1=`echo -e "Avg\x05$(awk '{print $1}' /proc/loadavg)\x01"`
# Mem percentage
S2=`echo -e "Mem\x05$(awk 'NR==2 {total=$2} NR==3 {used=$3} END {print int(used/total*100)}' <(free -m))%\x01"`
# Cpu tmp
S3=`echo -e "Cpu\x05$(awk '/Phy/ {print +$4"\260C"}' <(sensors))\x01"`
# Gpu tmp
S4=`echo -e "Gpu\x05$(awk '/Gpu/ {print $3"\260C"}' <(nvidia-smi -q -d TEMPERATURE))\x01"`
# Volume
S5=`echo -e "Vol\x05$(ponymix get-volume)%\x01"`
# Date
S6=`echo -e "$(date +"%a\x05%d\x01%b\x05%R")"`
xsetroot -name "$S1 $S2 $S3 $S4 $S5 $S6"
sleep 2s
done