Ok, encontrei uma resposta no Arch Wiki. Eles dão a próxima solução:
There is just one thing systemd cannot do (as of systemd-204): power management depending on whether the system is running on AC or battery. To fill this gap, you can create a single udev rule that runs a script when the AC adapter is plugged and unplugged:
/etc/udev/rules.d/powersave.rules SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/path/to/your/script true" SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/path/to/your/script false"
Para o meu Sony Vaio, tenho isso como minha configuração pessoal:
/etc/udev/rules.d/99-laptopac.rules
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/local/bin/sony-thermal.sh true"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/local/bin/sony-thermal.sh false"
/usr/local/bin/sony-thermal.sh
#!/bin/sh
help() {
cat <<EOF
$0: SONY laptop thermal profile management
This script selects between "performance" and "silent" modes depending
on whether laptop runs on AC power or battery power.
EOF
}
set_sony_thermal_profile() {
[ ! -d /sys/devices/platform/sony-laptop ] && exit $NA
[ ! -f /sys/devices/platform/sony-laptop/thermal_control ] && exit $NA
case $1 in
performance)
printf "Setting SONY thermal control to performace mode."
thermal_control=performance ;;
silent)
printf "Setting SONY thermal control to silent mode."
thermal_control=silent ;;
*)
printf "Setting SONY thermal control to balanced mode."
thermal_control=balanced ;;
esac
echo "$thermal_control" > /sys/devices/platform/sony-laptop/thermal_control && echo Done. || \
echo Failed.
}
case $1 in
true) set_sony_thermal_profile silent ;;
false) set_sony_thermal_profile performance ;;
help) help ;;
*) exit $NA ;;
esac
exit 0
Isso evita que a CPU do meu notebook entre em "afogamentos" continuamente, mesmo em condições de carga leve, com grande desempenho e perdas de experiência do usuário.