[systemd-devel] systemd-inhibit --what=handle-power-key broken with systemd 198

Lennart Poettering lennart at poettering.net
Fri Apr 5 10:21:42 PDT 2013


On Sat, 30.03.13 12:01, Manuel Reimer (Manuel.Spam at nurfuerspam.de) wrote:

> 
> Lennart Poettering wrote:
> >Generally on Linux only the X session in the fg will get the
> >keypresses. If you switch away with from it, the new one in the bg will
> >get it instead. logind will get active hence only if there's nobody on
> >that specific VT who wants to take the events.
> 
> The understanding, who processes keypresses, depends on the point of
> view. My daemon just connects to an input device, so it receives the
> keypresses *always* and the active VT doesn't matter.
> 
> >Well, note that these specific inhibitors are about inhibiting key
> >presses, not actions. i.e. the inhibitor for logind's suspend key
> >(i.e. the handling of the key) is independent of the inhibiting for the
> >suspend (i.e. the action code can ask for).
> 
> Inhibiting "shutdown" would go a bit too far. I don't want to
> prevent shutdowns that have been triggered by, for example, clicking
> a button in a GUI (KDE or something). And I think there is no way to
> create a selective inhibitor that only blocks a shutdown triggered
> via the power key, right?
> 
> Is there a way to enumerate the sessions, that could receive the
> power key, and register an inhibitor for all of them? Maybe even
> with an event that tells me if new sessions have been created?

You can't really do that, as we simply record the PID of the process
which created the inhibitor and then check if it is member of an active
session.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list