SketchyBar/plugins/topproc.sh

12 lines
324 B
Bash
Raw Normal View History

2021-08-13 13:58:00 +00:00
#!/usr/bin/env bash
TOPPROC=$(ps axo "%cpu,ucomm" | sort -nr | tail +1 | head -n1 | awk '{printf "%.0f%% %s\n", $1, $2}' | sed -e 's/com.apple.//g')
CPUP=$(echo $TOPPROC | sed -nr 's/([^\%]+).*/\1/p')
if [ $CPUP -gt 75 ]; then
2021-10-21 22:27:28 +00:00
sketchybar -m --set $NAME label="$TOPPROC"
2021-08-13 13:58:00 +00:00
else
2021-10-21 22:27:28 +00:00
sketchybar -m --set $NAME label=""
2021-08-13 13:58:00 +00:00
fi