#!/bin/bash #while true; do # sleep 1 # CPU IDLE time reader... slow. #tmp="/home/bla/.xmonad/CPUTIME_tmp" #tmp2="/home/bla/.xmonad/CPUTIME_tmp2" #STAT=`head -n1 /proc/stat | sed -e 's/cpu *//'` #CURRENT=`echo $STAT | sed -e 's/ /+/g' | bc` #CURRENT_IDLE=`echo $STAT | awk '{print $4}'` #PREVIOUS=`cat $tmp` #PREVIOUS_IDLE=`cat $tmp2` #echo $CURRENT > $tmp #echo $CURRENT_IDLE > $tmp2 #ELAPSED=$(($CURRENT - $PREVIOUS)) #ELAPSED_IDLE=$(($CURRENT_IDLE - $PREVIOUS_IDLE)) #echo $((100 * $ELAPSED_IDLE / $ELAPSED)) | dbar -l "IDLE: " -nonl # Calculate percentage of free memory (not including cache) total=`free | grep Mem | awk '{print $2}'` used=`free | grep -- '-/+' | awk '{print $3}'` # Set background echo -n "^bg(#000000)" # Print mem bar echo $((100 * $used / $total)) | dbar -l "MEM" -nonl # Print temperature (Used on laptop) #TEMP=`acpitool -t |head -n1| sed 's/.*, //g'` #echo -n " : $TEMP" # Print current throttle (Used on laptop) #THROTTLE=`grep '*T' /proc/acpi/processor/CPU0/throttling | sed -e 's/ *\*\(T[0-9]\).*/\1/g'` #echo -n " : $THROTTLE" # Add some date echo -n " : " date +"%H:%M, %d %B" #done