#!/bin/sh black='#1d2021' green='#b8bb26' white='#ebdbb2' grey='#a89984' blue='#6f8faf' red='#fb4934' darkblue='#458588' blue='#83a598' darkred="#cc241d" darkgreen="#98971a" darkyellow="#d79921" darkblue="#458588" darkmagenta="#b16286" darkcyan="#689d6a" darkgrey="#928374" yellow="#fabd2f" magenta="#d3869b" cyan="#8ec07c" bground="#282828" cpu() { cpu="$(mpstat 1 1 | awk '/Average/ { printf "%.2f ",100-$12 }')" temp="$(sensors | awk '/Tctl/ { print $2 } ' | tr -d '+')" printf "^c$black^^b$cyan^ CPU" printf "^c$black^^b$cyan^ $cpu%%" printf "^c$black^^b$cyan^ $temp " printf "^c$bground^^b$bground^" } mem() { printf "^c$blue^^b$bground^$(free -h | awk '/^Mem/ { print $3}' | sed s/i//g)" } volume() { stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]') [ "${stats##* }" = "on" ] && echo -n "^c$green^^b$black^ ${stats%% *}" || echo -n "^c$yellow^^b$darkgrey^ ${stats%% *}" } storage() { printf "^c$darkyellow^^b$bground^ $(df -H | awk '/\/$/ { print $4 }')" } clock() { printf "^c$black^^b$blue^ $(date +'%r') ^c$black^^b$darkblue^ $(date +'%A %D')" } while true; do sleep 1 && xsetroot -name "$(cpu) $(mem) $(volume) $(storage) $(clock) " done