How come Power Manager Settings does not work when computer is under virtual console?

I was wondering why power events does not work as expected when I'm using virtual console (or whatever the thing that appears after Ctrl-Alt-F1 is called).

I've set my laptop to go to sleep when lid is closed and it is working fine when I'm in graphical interface. But when I switch to virtual console, closed lid just turns the screen off.

How it is possible, I thought such low level stuff is controlled by daemons and they do not depend on the type of interface I'm in?


Solution 1:

You'll find the answer in /etc/acpi/lid.sh. You are correct that there is an ACPI daemon that responds to things like closing the lid. However, if you look at the line near the top of the script:

if [ `CheckPolicy` = 0 ]; then exit; fi

you'll see a line that cancels the whole thing. The CheckPolicy thing checks whether something like Gnome Power Manager is running on the current console. If so, it aborts, and lets the power manager handle it.

So, when GNOME is the active session, Gnome Power Manager handles the lid. When the console is the active session, the ACPI daemon handles the lid. If you read the rest of the lid.sh script, you'll see that all it does is blank the screen.