anacron is also not invoked when system boots on battery and later on
connected is to AC power, because systemd does not detect this change!
This is a no go for laptop users as they very rarely get notified of
pending updates, because the usual way is to connect the laptop to AC
power only when battery capacity is/gets low. Currently notification for
updates only works if laptop runs on AC power when booted up!

My workaround with good old udev rules I took from Arch-wiki:
https://wiki.archlinux.org/index.php/Power_management#Tools_and_scripts

I set up two udev-rules:

/lib/udev/rules.d/98-powersave.rules
# ATTR values:  "0" = on battery;       "1" = on AC power
SUBSYSTEM=="power_supply", ATTR{online}=="0",
RUN+="/usr/sbin/pm-powersave true"
SUBSYSTEM=="power_supply", ATTR{online}=="1",
RUN+="/usr/sbin/pm-powersave false"

Woirks great.

Reply via email to