What approach (the simplest) that we can use to receive notifications about changes in the power state (for example, when a computer goes into sleep mode, sleep mode, etc.) on Linux-based systems?
I need this mainly to save some state before going to bed and, of course, restore the state after the computer wakes up.
source share