Node: Session Management, Next: , Previous: Standard Properties, Up: Top



Session Management

Sawfish has fully integrated support for the X session management protocols. Also, this support is extensible to allow all Lisp modules to save and reload their own window state.

There are two methods of doing this. If the module only wants to save and restore the values of properties in each window's property list (i.e. those values set via window-put), then the following functions may be used:

sm-add-saved-properties &rest properties Function
sm-add-restored-properties &rest properties Function
Arrange for all symbols properties to be saved or restored with the session.

sm-saved-window-properties Variable
sm-restored-window-properties Variable
Lists of properties (symbols) to be saved or restored with each session.

If a Lisp module chooses to use this method it may add a function to the add-window-hook to act on the reloaded properties when the session is reloaded.

For more complex window properties that can't be saved straight from the window's plist two hooks are available:

sm-window-save-functions Variable
A list of functions, each of which is called when the state of each window is saved. Each function is called with a single argument (the window) and should return a list of alist elements that will be saved in the state file. (As such, only values with valid read syntaxes may be included.)

sm-restore-window-hook Variable
List of functions called when the state of a window is restored. Each is called with arguments (window alist), where alist defines the state saved for the window.

Each function should look for the properties it saved, and then take any action dependent on the values.

The following hook is also called.

sm-after-restore-hook Variable
Hook called after loading a saved session.

sm-save-directory Variable
The directory that will contain all Sawfish sessions. It must be a string. By default it is "~/.sawfish/sessions".

sm-sloppy-id-matching Variable
When loading sessions, the algorithm that matches saved session data to running clients requires that if one has a session id, then so must the other, and they must match. Setting this variable to true turns that feature off, allowing some broken clients to be session managed. Defaults to false.