This commit is contained in:
DarthMooMancer
2025-09-23 13:26:29 -04:00
5 changed files with 13 additions and 37 deletions
+1 -14
View File
@@ -26,19 +26,6 @@ else
fi
logical_threads=$(nproc --all)
# CPU usage (quick sample)
cpu_usage() {
read -r _ u n s i _ < <(grep '^cpu ' /proc/stat)
prev=$((u+n+s+i)); prev_idle=$i
sleep 0.1
read -r _ u n s i _ < <(grep '^cpu ' /proc/stat)
cur=$((u+n+s+i)); idle=$i
dt=$((cur - prev)); di=$((idle - prev_idle))
((dt>0)) && printf "%.1f%%" "$(bc -l <<< "100*($dt-$di)/$dt")" || echo "0.0%"
}
cpu_use=$(cpu_usage)
# Memory
mem_usage=$(free -h | awk '/Mem:/ {print $3 "/" $2}')
@@ -50,7 +37,7 @@ pkg_count=$(find /var/db/pkg -mindepth 2 -maxdepth 2 -type d 2>/dev/null | wc -l
# --- Define lines (easy to add new ones) ---
lines=(
"${cyan}CPU${reset}: ${physical_cores}c/${logical_threads}t/${cpu_use}"
"${cyan}CPU${reset}: ${physical_cores}c/${logical_threads}t"
"${green}Memory${reset}: ${mem_usage}"
"${red}Age${reset}: ${sys_age} days"
"${blue}Pkgs${reset}: ${pkg_count}"