iletras
iletras

Reputation: 244

How does gnome put a system to sleep on inactivity and wake it on keypress (or other activity)? And where is the code for it?

Where are the documents that describe Linux system's sleep/wake process (note, not the states but the process) and where is the code that implements entering and exiting them?

Wake-On-Keypress is probably the most common/standard action pair on GUIs. Windows is better at Wake-On-Mouse movement. Servers should be smooth with Wake-On-Lan.

Asking here to learn/get a handle on the process as it is done currently by a common Linux GUI - Gnome. Can't find much mention of it via search engining.

Upvotes: 0

Views: 120

Answers (1)

larsks
larsks

Reputation: 311278

Most of that is implemented in the kernel (see e.g. here). Gnome suspends a system by making a request to the kernel -- either via a system call or via the interface in /sys/power/state (see docs here).

The ability to wake on a keypress is implemented primarily by your hardware -- which ultimately triggers an event that is processed by the kernel, which takes care of restoring system state and then Gnome picks up where it left off.

Upvotes: 3

Related Questions