mirror of
https://github.com/StepanovPlaton/dotfiles.git
synced 2026-04-03 20:30:46 +04:00
050125
This commit is contained in:
11
.scripts/dwmblocks/cpu
Executable file
11
.scripts/dwmblocks/cpu
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/env bash
|
||||
colors_path=$HOME/.cache/wal/colors.sh
|
||||
cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||
|
||||
# cpu_usage=$(echo "$cpu_usage" | cut -c1-1)
|
||||
cpu_usage=$(printf "%.0f" "$cpu_usage")
|
||||
|
||||
if [ -f "$colors_path" ]; then
|
||||
source $colors_path
|
||||
echo "^b$color1^^c$color0^ ^d^^b$color8^^c$color0^ $cpu_usage% ^d^"
|
||||
fi
|
||||
Reference in New Issue
Block a user