mirror of
https://codeberg.org/gigirassy/niri-dotfiles
synced 2026-08-30 15:19:32 +00:00
25 lines
472 B
Bash
25 lines
472 B
Bash
#!/bin/sh
|
|
# tiny microdaemon to keep fans cool
|
|
exec 2>&1
|
|
|
|
while true; do
|
|
temp=0
|
|
|
|
for f in /sys/class/thermal/thermal_zone*/temp; do
|
|
[ -r "$f" ] || continue
|
|
read -r t < "$f"
|
|
[ "$t" -gt "$temp" ] && temp=$t
|
|
done
|
|
|
|
if [ "$temp" -ge 55000 ]; then
|
|
state=1
|
|
else
|
|
state=0
|
|
fi
|
|
|
|
for f in /sys/class/thermal/cooling_device*/cur_state; do
|
|
[ -w "$f" ] && printf '%s\n' "$state" > "$f"
|
|
done
|
|
|
|
sleep 5
|
|
done |