dotfiles/waybar-cpu.sh

16 lines
209 B
Bash
Executable File

#!/usr/bin/env bash
print_status() {
top -bn1 | awk '/^%Cpu/ {printf "%d%%  \n", 100 - $8}'
}
print_status
if [ -z "$1" ] || [ "$1" -ne "once" ]; then
while sleep 1; do
print_status
done
fi