#!/usr/bin/env sh set -e ARG=${1:-$BLOCK_BUTTON} case $ARG in 1) notify-send --urgency=low \ "Process status" \ "$(ps k-c -eo pid,pcpu,comm | head -10 \ | sed -E 's/ +/ /g;s/^ +//' \ | column -tl 3 -R 1,2 -s ' ')" ;; 3) notify-send --urgency=low \ "Process status" \ "$(ps k-vsz -eo pid,pcpu,vsz,comm \ | head -10 \ | awk 'NR>1 {$3 = int($3/1024)"M";}{print;}' \ | sed -E 's/ +/ /g;s/^ +//' \ | column -tl 4 -R 1,2,3 -s ' ')" ;; esac LOAD_1m=$(sed -E 's/^([^ ]+).*/\1/' /proc/loadavg | tr -d '\n') # Silence is golden [ "$(echo "${LOAD_1m} < 1" | bc -l)" -eq 1 ] && exit 0 # Thermals TEMP="$(awk '{s+=$1}END{printf "%.1f", s / (1000*NR)}' /sys/class/thermal/thermal_zone*/temp)" printf "[%s  %.01f°]\n" "${LOAD_1m}" "${TEMP}"