diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-03 19:56:25 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-03 19:56:25 +0200 |
commit | f0b527f61e251a879a179ff4fef16baaa486c047 (patch) | |
tree | 643a5717fcf243c5430cf8b0609d23bd2fa41b59 /pw-systemstats | |
parent | 95a142be5215939fc6b5be643e4fa44650415e2c (diff) | |
download | scripts-f0b527f61e251a879a179ff4fef16baaa486c047.tar.gz scripts-f0b527f61e251a879a179ff4fef16baaa486c047.tar.bz2 scripts-f0b527f61e251a879a179ff4fef16baaa486c047.zip |
update
Diffstat (limited to 'pw-systemstats')
-rwxr-xr-x | pw-systemstats | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pw-systemstats b/pw-systemstats new file mode 100755 index 0000000..67ee45c --- /dev/null +++ b/pw-systemstats @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +CPU_TEMP=$(sensors | awk ' + /^Tdie|^Package id|^Core 0|^CPU|^temp1/ { + gsub(/[+°C]/, ""); + for (i=1; i<=NF; i++) { + if ($i ~ /^[0-9]+(\.[0-9]+)?$/) { + gsub(/\..*/, "", $i); + print $i; + exit; + } + } + }') + +# Debug CPU temperature detection, if not found, return N/A +if [ -z "$CPU_TEMP" ]; then + # Try simpler pattern as fallback + CPU_TEMP=$(sensors | grep -E '^(Core 0|Package id 0|CPU)' | awk '{print $3}' | tr -d '+°C' | head -n1) +fi + +[ -z "$CPU_TEMP" ] && CPU_TEMP="N/A" + + +# Try different fan sensors +FAN_SPEED=$(sensors | awk '/^fan|^cpu_fan/ {print $2}') +[ -z "$FAN_SPEED" ] && FAN_SPEED="N/A" + + +# Send to bar +echo " $FAN_SPEED $CPU_TEMP°C" + +# Clicking on bar +case $BLOCK_BUTTON in + 1) notify-send "$(sensors)";; + 2) notify-send "button 2 clicked";; + 3) notify-send "button 3 clicked";; +esac |