Support for session manager?


#1

Hey!

Is there any current or planned support for session management, ie saving/restoring state between desktop sessions?

http://doc.qt.nokia.com/4.6/session.html
http://en.wikipedia.org/wiki/X_session_manager


#2

Maybe I’m missing a fundamental point here, but isn’t “session management” just a fancy term for what most apps do anyway: i.e. to return to the same state that it was in when you closed it down?


#3

Well, yes and no. In addition to what you mention, X11 provides a session manager to save and restore the entire state of your desktop(s) when you logout. This uses the XSMP protocol.

Example: At this moment, I have eight desktops in KDE, and most of them have several applications running on them. If would now logout/shutdown/restart my computer, the session manager takes care of saving the state of all these applications and desktops. When the computer boots and I login next time, it will automagically restore all the applications in the exact same spot and with the same status as before. Editors might reload the same text and cursor position, terminal windows go back to the same working directories, half-written emails just pop up where they were before with the text and cursor identical etc.

For this to work, the gui framework would implement XSMP, and then provide a few callbacks to the application for session save/restore.

For instance, on QT, you reimplement QApplication::saveState(). In saveState() the applications is expected to save what it needs to restore its state, together with a unique sessionId which is provided by the session manager. On later application startup (ie after a reboot), the app would check (qApp->isSessionRestored()) if it should restore, get the same sessionID back from the session manager, load the correct data and restore itself to the previous state. Of course, QT hides XSMP behind the scenes. For instance, after saving state, QT will tell the session manager how it wants to be restarted again (a command-line argument) and then uses that argument to know if it’s being restored and which sessionID to restore.

I think the GTK api handles sessions in a much similar way.

The links previously posted give a good overview. In addition, here is a PDF with the XSMP specs:

http://www.xfree86.org/current/xsmp.pdf


#4

Well, I must admit that if you want me to add a feature, then saying “Qt does this…” usually do the trick! Too busy this week to think about it, but feel free to keep nagging me about it.

Seems a bit platform-specific, though… there’s nothing resembling this on Mac or PC, is there?


#5

:lol:
And I must admit that it is not a specific feature request but rather an inquiry about current status. But of course, who wants to maintain a cross platform toolkit and be beaten by qt or gtk :wink:

I’m afraid it might be X11-specific, at least according to the above QT-link (On Mac OS X, and Microsoft Windows versions prior to Windows 2000, there is nothing like complete session management for applications yet, i.e. no restoring of previous sessions. (Windows 2000 and XP provide “hibernation”…

Still, it might not be too difficult to support for X11 (I guess one can read the QT source and get a few hints), and it is indeed a very neat feature which would significantly improve Juce’s integration with the Linux/X11 desktop environment.