Session restoration and autostart

Lubos Lunak l.lunak at suse.cz
Mon Sep 12 14:40:18 BST 2005


On Friday 09 of September 2005 22:00, David Jarvie wrote:
> On Thursday 08 Sep 2005 13:34, Lubos Lunak wrote:
> >  I've already said it, and I will repeat it: Sessions and autostart are
> > not meant to be used together. Use either one or the other one, not both.
> > If you
> > use sessions, just handle saving and restoring of the data, the system
> > will take care of everything else. If you want to use autostart for some
> > reason, take care of everything yourself. End of story. Why would you
> > need both?
>
> For one thing, to avoid reinventing the wheel. I don't particularly want to
> write window restoring code when session restoration could take care of it
> for me. But I definitely have to use autostart.
>
> >  If I'm not mistaken, you just use session saving for storing window
> > positions. So either just use session saving (boy, do I hate all those
> > "are you really really sure you don't want this app next time?" dialogs),
> > or just use autostart if you want it that way for some reason and save
> > the positions yourself.
>
> I wonder how many developers have fallen foul of the rule that you can't
> use autostart and session restoration together? It isn't obvious that the
> rule exists unless you happen to have read the right stuff in the mailing
> lists. I for one have spent quite a bit of time trying to sort out bugs
> arising from this over the past 2 or 3 years, and I suspect from his
> comments that Christian Esken may have too. And no doubt we're not the only
> ones. Either there should be big warnings in the documentation (which
> hopefully people might eventually spot), or preferably autostart and
> session restoration should be made compatible.

 There's no rule. They simply doesn't work well together because they're 
different concepts. Session is something like a snapshot of the desktop. 
During session saving applications are saving all their state to session 
files and it should be possible to restore exactly that state just from the 
saved session data. Logout is not just one action but actually two phases, 
session saving and shutdown. The same way it should be possible to save the 
state anytime, for crash recovery or whatever. And during KDE start you could 
be presented with a list of sessions to restore. Autostart is just plain 
start-it-during-every-KDE-startup. How would you want to combine two sets of 
data, one coming from autostart (which comes from who knows where) and 
another coming from a "random" session? In fact autostart shouldn't exist at 
all and everything launched should be just part of the session. And the 
nitpicking optimization guy in me isn't quite happy with the double launching 
of the application.

 Ok, so much for the theory. In practice it's not so, because those features 
are not implemented in ksmserver, and SM support in most apps is pretty 
broken, probably because people don't really get this sessions thing. And 
autostart seems to be much simpler to understand.

 Either way, how exactly would you want those two work together? And, while 
I'm at it, why do you definitely need autostart?

>
> How about simply making KApplication::isRestored() return true during a
> session manager activation, even if the program was already running before
> that? Would that work?

 Technically, yes, it'd mean adding similar code like there's already for 
startup notification ('asn'). In practice ... I have no idea *shrug*.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/




More information about the kde-core-devel mailing list