mfetch
This commit is contained in:
+2
-18
@@ -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 ---
|
||||
|
||||
Reference in New Issue
Block a user