updated scripts and waybar

This commit is contained in:
2025-08-18 19:31:04 +02:00
parent 6e647070d8
commit 01f7b4fb8e
20 changed files with 305 additions and 268 deletions

21
waybar/scripts/cpu_info.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
USAGE=$(mpstat 1 1 | awk '/Average:/ {print 100 - $12}')
TEMP=$(cat /sys/class/hwmon/hwmon3/temp1_input)
TEXT="$(printf "%.1f" $(echo "$USAGE"))% TEMP: $(printf "%.1f" $(echo "scale=2; $TEMP"/1000 | bc -l))C"
CPU=$(lscpu | grep 'Model name' | awk -F': ' '{print $2}' | sed 's/^[ \t]*//')
# TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk '{output = output sprintf("%.1f%%\t%s\\n", $1, $2)} END {printf "%s", output}')
# TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk -v ncores=$(nproc) '{printf "%.1f%%\t%s\n", $1/ncores, $2}')
TOOLTIP=$(ps -eo %cpu,comm --sort=-%cpu | head -n 6 | sed '1d' | awk -v ncores=$(nproc) '{printf "%.1f%%\t%s\\n", $1/ncores, $2}')
# TOOLTIP=$(top -b -n 1 | sed '1,7d' | head -n 5 | awk '{output = output sprintf("%.1f%%\t%s\\n", $9, $12)} END {printf "%s", output}')
CLASS=""
if (( $(echo "$USAGE > 95" | bc -l) )); then
CLASS="max"
elif (( $(echo "$USAGE > 75" | bc -l) )); then
CLASS="high"
else
CLASS="normal"
fi
echo "{\"text\":\"CPU: $TEXT\", \"tooltip\": \"$TOOLTIP\", \"class\":\"$CLASS\"}"