mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2025-02-07 04:54:18 -05:00
17 lines
417 B
Bash
Executable File
17 lines
417 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
cpu() {
|
|
icon=" "
|
|
|
|
read -r cpu a b c previdle rest < /proc/stat
|
|
prevtotal=$((a+b+c+previdle))
|
|
sleep 0.5
|
|
read -r cpu a b c idle rest < /proc/stat
|
|
total=$((a+b+c+idle))
|
|
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
|
|
cpu=" $cpu%"
|
|
printf "%s%s\n" "%{F#1e222a}%{B#75A4CD}$icon %{F-}%{B-}" "%{F#1e222a}%{B#C4C7C5}$cpu %{F-}%{B-}"
|
|
}
|
|
|
|
cpu
|