xsm
X Session Manager: manage X sessions
SYNOPSIS
xsm [ -option ... ]
PARAMETERS
-display display
Specifies the X server to connect to. This typically follows the format hostname:display.screen.
-session session_name
Specifies the name of the session to use. If a session with this name has been saved previously, xsm will attempt to restore it.
-verbose
Causes xsm to print verbose messages to standard error, useful for debugging.
-quiet
Suppresses verbose messages, overriding the default or other settings.
-geometry geometry
Specifies the initial size and location for the xsm window, if it displays one.
-builtin-save
Instructs xsm to automatically save the current session state without prompting the user.
-shutdown
Requests the display manager (if present and supportive) to shut down the X server and potentially the system.
-reboot
Requests the display manager (if present and supportive) to reboot the system.
-version
Prints the version information for xsm and then exits.
-help
Prints a brief usage message and then exits.
DESCRIPTION
The xsm command is the X Session Manager, a core component of the X Window System responsible for saving and restoring the state of a user's desktop session. It operates by communicating with session-aware client applications using the X Session Management Protocol (XSMP).
When a user logs out or requests a session save, xsm instructs registered applications to save their current state (e.g., window position, open documents, application settings). Upon logging back in or restoring a session, xsm retrieves this saved state and relaunches the applications, attempting to restore them to their previous condition.
While xsm provides the fundamental session management capabilities, in modern Linux desktop environments like GNOME or KDE, it often runs as a backend component, with the desktop environment's own session manager providing a higher-level user interface and managing the session lifecycle.
CAVEATS
xsm's ability to save and restore application states heavily relies on applications being 'session-aware' and correctly implementing the X Session Management Protocol (XSMP). Many older or simpler X applications may not support session management. In modern desktop environments, direct interaction with xsm is rare, as the DE's own session manager typically handles these functions at a higher level, often using xsm as an underlying component. Session data is typically stored in the user's home directory, often under ~/.xsm.
SESSION FILES
When a session is saved, xsm typically creates a directory, often named ~/.xsm/ followed by a unique session ID. Within this directory, configuration files and scripts are stored that describe the state of applications and how to restart them.
INTERACTION WITH DISPLAY MANAGERS
xsm is frequently started by an X Display Manager (like xdm or GDM/LightDM) upon user login. The display manager and xsm cooperate to manage the X session's lifecycle, including clean shutdown and restart procedures.
HISTORY
xsm has been an integral part of the X Window System since the introduction of the X Session Management Protocol (XSMP). It emerged as a solution to provide a consistent user experience across X sessions, allowing users to resume their work exactly where they left off. It was developed as part of the X.Org X11 distribution. While its core functionality remains, its role has evolved from a directly user-facing tool to a more fundamental, background service, especially with the rise of comprehensive desktop environments that integrate session management seamlessly.