In almost all Linux distributions you can configure that when some conditions are met the computer will be put to sleep/hibernate. After some time of inactivity, or when the battery is low, etc..
As far as I understand, systemd just expose the functionality of hibernate/suspend/hybrid-sleep - but doesn't decide to do any of them in response to the system state.
UPower - is an interface that let you check historical and current power status, but again doesn't act on its own.
Except that there are of course some GUI tools that let you configure these settings. But I guess these are not doing the actual monitoring.
So who is constantly monitoring my battery and activity, and decides to take the proper action accordingly? I would love to see the actual lines of code for that. Couldn't find myself.
Thanks a lot!
If this is distribution depended I'm talking about Ubuntu with Cinnamon.