Skip to content

Instantly share code, notes, and snippets.



Created Apr 30, 2016
What would you like to do?
DClock: statusbar widget for DWM
while true; do
loadAvg=$(cat /proc/loadavg | cut -d ' ' -f -4)
timeStr=$(date '+%a %b %d %H:%M:%S')
memAvail=$(grep -Po 'MemAvailable.*\d+' /proc/meminfo|cut -d ':' -f 2)
memTotal=$(grep -Po 'MemTotal.*\d+' /proc/meminfo|cut -d ':' -f 2)
memBusy=$(( $memTotal - $memAvail ))
xsetroot -name "RAM: $(( 100 * memBusy / memTotal ))% | CPU: $loadAvg | $timeStr"
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.