blob: 11b9efe8a25ec4879be8d1b8116a552e9142021f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/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}"
|