mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2024-11-28 18:28:39 -05:00
20 lines
472 B
Bash
Executable File
20 lines
472 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
cpu() {
|
|
# load colors
|
|
. $HOME/.config/flexiflow_bar/bar_themes/minimal-mistakes
|
|
|
|
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)))
|
|
|
|
printf " %s %s \n" "^c$Foreground^^b$Orange^$icon" "^c$Foreground^^b$Orange_Bright^ $cpu%"
|
|
}
|
|
|
|
cpu
|