mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 20:03:10 +00:00
9 lines
428 B
Bash
Executable file
9 lines
428 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
CORE_COUNT=$(sysctl -n machdep.cpu.thread_count)
|
|
CPU_INFO=$(ps -eo pcpu,user)
|
|
CPU_SYS=$(echo "$CPU_INFO" | grep -v $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}")
|
|
CPU_USER=$(echo "$CPU_INFO" | grep $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}")
|
|
|
|
sketchybar --push cpu_sys $CPU_SYS \
|
|
--push cpu_user $CPU_USER
|