fan-profile: render auto mode and reconcile fw-fanctrl on poll
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,19 @@ if [ "$1" = "--menu" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -f "$STATE_FILE" ]; then
|
||||
PROFILE=$(powerprofilesctl get 2>/dev/null)
|
||||
MAPPED=$(map_profile_to_strategy "$PROFILE" 2>/dev/null)
|
||||
if [ -n "$MAPPED" ]; then
|
||||
ACTIVE=$(fw-fanctrl print 2>/dev/null | awk -F"'" '/^Strategy:/{print $2}')
|
||||
[ "$ACTIVE" != "$MAPPED" ] && fw-fanctrl use "$MAPPED" >/dev/null 2>&1
|
||||
printf '{"text": " auto", "tooltip": "Auto fan strategy\\nProfile: %s → %s\\nClick to change", "class": "auto"}\n' "$PROFILE" "$MAPPED"
|
||||
else
|
||||
printf '{"text": " auto (?)", "tooltip": "Auto: power-profiles-daemon unreachable or unknown profile\\nClick to change", "class": "auto"}\n'
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
OUTPUT=$(fw-fanctrl print 2>/dev/null)
|
||||
CURRENT=$(echo "$OUTPUT" | awk -F"'" '/^Strategy:/{print $2}')
|
||||
SPEED=$(echo "$OUTPUT" | awk '/^Speed:/{print $2}')
|
||||
|
||||
Reference in New Issue
Block a user