mutter is too eager to suspend when unplugging the power
Promoting this from IRC:
<ajax> why, when i unplug my fully charged (but admittedly idle) laptop while locked, does it threaten to suspend in 30 seconds?
<ajax> "it's been longer than the suspend-if-unplugged delay and the state _just_ changed to unplugged, go go go" perhaps?
<hadess> the idle timeouts are calculated in mutter
<hadess> but unplugging a laptop should be considered an unidle event
<ajax> i've seen this or something like it for a while but not been able to fully characterize it. i _think_ it used to happen while the session was unlocked too; i haven't seen that recently, but haven't been watching super closely
<ajax> the while-locked bit just now happened, so
<hadess> look like it isn't
<hadess> mutter just considers opening or closing the lid an unidle event, it doesn't check the battery status
<hadess> it might be the easiest place to fix it though
<hadess> https://gitlab.gnome.org/GNOME/mutter/blob/main/src/backends/meta-backend.c#L671 <- need to check on-battery property too
<hadess> ajax: can you file an issue against mutter?