You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automatic switch profile to powersave when battery below a certain threshold
You may find this useful:
#!/bin/bash
BAT=$(echo /sys/class/power_supply/BAT*)
BAT_STATUS="$BAT/status"
BAT_CAP="$BAT/capacity"
LOW_BAT_PERCENT=20
AC_PROFILE="throughput-performance"
BAT_PROFILE="balanced"
LOW_BAT_PROFILE="powersave"# tuned-adm list# wait a while if needed
[[ -z$STARTUP_WAIT ]] || sleep "$STARTUP_WAIT"# start the monitor loop
prev=0
whiletrue;do# read the current stateif [[ $(cat "$BAT_STATUS")=="Discharging" ]];thenif [[ $(cat "$BAT_CAP")-gt$LOW_BAT_PERCENT ]];then
profile=$BAT_PROFILEelse
profile=$LOW_BAT_PROFILEfielse
profile=$AC_PROFILEfi# set the new profileif [[ $prev!="$profile" ]];thenecho setting power profile to $profile# Fedora 41 uses tuned-adm, which is incompatible with power-profiles-daemon
tuned-adm profile $profile# powerprofilesctl set $profilefi
prev=$profile# wait for the next power change event
inotifywait -qq "$BAT_STATUS""$BAT_CAP"done
I found the original script here and made some tuning (pun intended) to make it work with tuned.
You can create a systemd service and enable it at boot, like the linked guide describes.
Automatic switch profile to powersave when battery below a certain threshold
The text was updated successfully, but these errors were encountered: