#!/bin/bash #colors clear="#C7C7C7" grey="#7D7D7D" # mem section memu(){ memu="$(free -m | sed -n 's|^-.*:[ \t]*\([0-9]*\) .*|\1|gp')" echo "^s[right;$grey;mem]^s[right;$clear;$memu]" } memt(){ memt="$(free -m | sed -n 's|^M.*:[ \t]*\([0-9]*\) .*|\1|gp')" echo "^s[right;$clear;/$memt ]" } # cpu section cpu(){ cpu="$(eval $(awk '/^cpu /{print "previdle=" $5 "; prevtotal=" $2+$3+$4+$5 }' /proc/stat); sleep 0.4; eval $(awk '/^cpu /{print "idle=" $5 "; total=" $2+$3+$4+$5 }' /proc/stat); intervaltotal=$((total-${prevtotal:-0})); echo "$((100*( (intervaltotal) - ($idle-${previdle:-0}) ) / (intervaltotal) ))")" echo "^s[right;$grey;cpu]^s[right;$clear;$cpu% ](1;spawn;urxvt -e htop)" } # hdd section hdd(){ hdd="$(df -h|grep sda3|awk '{print $5}')" echo "^s[right;$grey;hdd]^s[right;$clear;$hdd ](1;spawn;urxvt -e ncdu)" } # temperatures tempcpu(){ tempcpu="$(cat /sys/devices/platform/thinkpad_hwmon/temp1_input | awk '{print $1/1000}')" echo "^s[right;$grey;tmp]^s[right;$clear;$tempcpu°]" } temphdd(){ temphdd="$(cat /sys/devices/platform/thinkpad_hwmon/temp3_input | awk '{print $1/1000}')" echo "^s[right;$clear;$temphdd°]" } tempgpu(){ tempgpu="$(cat /sys/devices/platform/thinkpad_hwmon/temp2_input | awk '{print $1/1000}')" echo "^s[right;$clear;$tempgpu° ]" } # date/time section dte(){ dte="$(date +"%a %d/%m")" echo "^s[right;$grey;$dte·]" } tme(){ tme="$(date +"%H:%M")" echo "^s[right;$clear;$tme ]" } # internet section int(){ int="$("$HOME/bin/speed-wmfs.sh")" echo "^s[right;$grey;net] ^s[right;$clear;$int ](1;spawn;urxvt -e net-monitor)" } # power pwr(){ pwrsta="$(cat /sys/class/power_supply/BAT0/status | cut -c 1)" pwrperc="$(awk 'sub(/,/,"") {print $4}' <(acpi -b) | cut -d , -f 1 $1)" if [ "$pwrsta" == "F" ]; then pwr="F" else pwr="$pwrsta·$pwrperc" fi echo "^s[right;$grey;bat]^s[right;$clear;$pwr ]" } TIMING=1 statustext() { wmfs -c status "testbar $(pwr) $(cpu) $(memu)$(memt) $(hdd) $(int) $(tempcpu) $(temphdd) $(tempgpu) $(dte) $(tme)" } while true; do statustext sleep $TIMING done