#!/bin/sh case $BLOCK_BUTTON in 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd,%cpu | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)\\n(100% per core)" ;; 2) setsid -f "$TERMINAL" -e btop ;; 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. - Click to show intensive processes. - Middle click to open btop." ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # Temperature source, in order of preference: # Intel x86 -> "Core 0" (field 3, e.g. +45.0°C) # AMD x86 -> "Tdie/Tctl" (field 2) # Apple Silicon -> Asahi exposes no CPU die sensor; fall back to the # NVMe "Composite" temp as a system-temperature proxy temp=$(sensors 2>/dev/null | awk '/Core 0/ {print $3; exit}') [ -z "$temp" ] && temp=$(sensors 2>/dev/null | awk '/Tdie|Tctl/ {print $2; exit}') [ -z "$temp" ] && temp=$(sensors 2>/dev/null | awk '/Composite/ {print $2 $3; exit}') [ -n "$temp" ] && printf '🌡%s\n' "$temp"