This commit is contained in:
DarthMooMancer
2025-11-07 23:38:44 -05:00
parent e443755f7b
commit 35dfcaa2fa
3 changed files with 6 additions and 22 deletions
+2 -18
View File
@@ -15,20 +15,6 @@ fi
# Strip ANSI escapes
strip_colors() { printf '%s' "$1" | sed -r 's/\x1B\[[0-9;]*[mK]//g'; }
# --- Collect stats ---
# CPU (cores/threads)
if command -v lscpu >/dev/null; then
sockets=$(lscpu | awk -F: '/Socket\(s\)/{gsub(/ /,"");print $2;exit}')
cores_per=$(lscpu | awk -F: '/Core\(s\) per socket/{gsub(/ /,"");print $2;exit}')
physical_cores=$((sockets * cores_per))
else
physical_cores=$(grep -E 'cpu cores' /proc/cpuinfo | head -1 | awk '{print $4}')
fi
logical_threads=$(nproc --all)
# Memory
mem_usage=$(free -h | awk '/Mem:/ {print $3 "/" $2}')
# System age
sys_age=$(( ( $(date +%s) - $(stat -c %W / 2>/dev/null || echo 0) ) / 86400 ))
@@ -37,10 +23,8 @@ 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"
"${green}Memory${reset}: ${mem_usage}"
"${red}Age${reset}: ${sys_age} days"
"${blue}Pkgs${reset}: ${pkg_count}"
"${green}Age${reset}: ${sys_age} days"
"${magenta}Pkgs${reset}: ${pkg_count}"
)
# --- Compute max width ---