dotfiles/.local/scripts/status/0030_0_cpu

9 lines
276 B
Bash
Executable File

#!/bin/bash
COLOR1="#990057"
COLOR2="#FF00B2"
usage=$(cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' | cut -d'.' -f1)"%"
echo "^c$COLOR1^^b$COLOR2^  ^b$COLOR1^^c$COLOR2^ $usage ^d^"