power manager / session manager interaction

Brian J. Tarricone bjt23 at cornell.edu
Fri Jul 17 01:20:15 PDT 2009


Hi all,

Not sure if this is the best place for a discussion about this, but it 
relates to cross-desktop standards, so... here goes.

Currently xfce4-session is capable of (upon request) shutting down, 
rebooting, suspending, and hibernating the system (the first two through 
HAL or a sudo-based helper, the last two through HAL).

Personally, I've always thought it questionable that the session manager 
should be dealing with it at all, but over in Xfce-land we didn't have 
anything 'higher' in the stack to handle it, and users want a GUI way of 
shutting down and rebooting, so... there you have it.

More recently, someone wrote us a nice power manager for Xfce, and 
adopted the org.freedesktop.PowerManagement interface.

So then we got into a little trouble.  An example:

1.  User asks power manager to shut down the system.
2.  System shuts down, session manager has no clue, and doesn't save the 
session or tell apps the session is sending so they have a chance to 
prompt the user about any unsaved work.

How do we solve this in a cross-desktop manner?  Here's an idea:

1.  User asks power manager to shut down the system.
2.  Power manager connects to session manager via XSMP and tells the SM 
to log out.
3.  SM logs out.
4.  Power manager waits for its X connection to die and then shuts down 
the system.

But there's a problem with that too, though it's mainly cosmetic: on a 
faster system, the user will see a login dialog before/while the system 
is shutting down, because the session manager just quit, which caused X 
to quit, which usually brings you back to GDM, or KDM, or slim, or 
qingy, or whatever.  Most machines take longer to shut down than they 
take to bring up a new X server and start a display manager.

Another route would be to always go through the session manager first 
(when asking for a reboot or shutdown), which will take care to end the 
session cleanly and then ask the power manager to handle the rest, but 
we of course can't keep other apps from asking the power manager to shut 
down or reboot.

So I'm not really sure where to go from here.  I'd rather not invent 
some private interface so xfpm and xfce4-session can work out this sort 
of thing.  People might want to use g-p-m with Xfce, or they might want 
to use xfpm elsewhere, and that would make them somewhat deficient 
outside their primary environment.

Is there a recommended best practice for how the power manager and 
session manager should interact during session end?  Are there other 
interfaces for synchronising this sort of things that I've forgotten. 
Any advice would be appreciated.

Thanks,
Brian


More information about the xdg mailing list