mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-12 08:51:01 +01:00
- Move fresh-install/ → scripts/single_use/fresh-install/ - Move hosts/ → scripts/periodic_background/hosts/ - Move i3-configuration/ → scripts/periodic_background/i3-configuration/ - Delete linux_configuration/LaTeX/, nix-poc/, report/ (dead dirs) - Move repo-root scripts/ → meta/scripts/ - Update root .pre-commit-config.yaml: scripts/ → meta/scripts/ (9 entries) - Update run.sh ARTIFACT_INIT_SCRIPT to meta/scripts/ - Update fresh-install/main.sh: hosts/install.sh + i3-configuration/install.sh paths - Update check_python_location.sh: add meta/scripts/ to exception list - Fix midnight flakiness in test_recent_workout_returns_true: use timezone-aware local noon instead of now-1h to avoid SQL date() boundary issues
55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# i3blocks motherboard-temperature indicator, zero-fork per invocation.
|
|
#
|
|
# Reads /sys/class/hwmon directly instead of forking `sensors | awk | tr`.
|
|
# Prefers Super-I/O chips (nct*, it*, f71*) which expose the true board
|
|
# sensor; falls back to the first non-CPU/GPU/NIC hwmon with a temp1_input.
|
|
|
|
set -u
|
|
|
|
# Nerd Font glyph: thermometer icon (U+F2C9).
|
|
ICON=$'\uf2c9'
|
|
|
|
hwmon=''
|
|
for d in /sys/class/hwmon/hwmon*/; do
|
|
[[ -r ${d}name ]] || continue
|
|
read -r n < "${d}name"
|
|
case $n in
|
|
nct* | it87* | it8* | f71*)
|
|
hwmon=$d
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
if [[ -z $hwmon ]]; then
|
|
for d in /sys/class/hwmon/hwmon*/; do
|
|
[[ -r ${d}name && -r ${d}temp1_input ]] || continue
|
|
read -r n < "${d}name"
|
|
case $n in
|
|
k10temp | coretemp | amdgpu | nouveau | nvme | r8169* | iwlwifi*) continue ;;
|
|
*)
|
|
hwmon=$d
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
if [[ -z $hwmon || ! -r ${hwmon}temp1_input ]]; then
|
|
printf '<span color="#FF5555">%s MB: N/A</span>\n' "$ICON"
|
|
exit 0
|
|
fi
|
|
|
|
read -r milli < "${hwmon}temp1_input"
|
|
temp=$((milli / 1000))
|
|
|
|
if ((temp < 50)); then
|
|
color='#50FA7B'
|
|
elif ((temp < 70)); then
|
|
color='#F1FA8C'
|
|
else
|
|
color='#FF5555'
|
|
fi
|
|
|
|
printf '<span color="%s">%s %s°C</span>\n' "$color" "$ICON" "$temp"
|