dwmblocks/scripts/sb-cpu
2022-01-08 17:04:07 +00:00

5 lines
184 B
Bash

#!/bin/sh
top -b -n2 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' -v prefix="CPU " '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f%%\n", prefix, 100 - v }'