GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage


Starting the session

A sessiond-based session should be started via a display manager, using the provided sessiond session desktop entry.

For example, configure lightdm to start a sessiond session by setting user-session=sessiond in /etc/lightdm/lightdm.conf.

Running a window manager

To use sessiond alongside a window manager, the window manager service must include:


An example twm.service:

Description=Window manager



Enable the window manager service with systemctl --user enable twm.service. Now, when the sessiond session is started via the display manager, this service will run as the window manager and the session will be stopped when it exits.

Running services binds to provided by systemd. See in systemd.special(7) for more information about graphical sessions.

To run a service in the graphical session, <service>.service should contain:


so the service is stopped when the session ends, and:


so the service is started when the session begins.

It can then be enabled with systemctl --user enable <service>.

Example services can be found here.

Manually stopping the session

The session can be stopped with sessionctl stop. This will stop and all units that are part of the session.

A service that is part of the graphical session can be responsible for stopping the session. To configure a service to stop the session when it exits, include:

ExecStopPost=/usr/bin/sessionctl stop

Locking the session

By default, the session is locked when it becomes idle and before sleeping. This is configured in the [Lock] section of the configuration file. The session can be manually locked by running sessionctl lock.

To configure a service to act as the screen locker, include:

ExecStopPost=/usr/bin/sessionctl unlock

so the session is considered unlocked when the locker exits, and:


so the service is started when the session locks. Then enable it.

Below is an example i3lock.service:

Description=Lock X session with i3lock

ExecStart=/usr/bin/i3lock -n -c 000000
ExecStopPost=/usr/bin/sessionctl unlock


Inhibiting inactivity

Inhibitor locks can be acquired when the session should be considered active while a given command is running, e.g. a media player.

The sessiond-inhibit script provides a simple interface to acquire a lock before running a command and release it when the command returns.

usage: sessiond-inhibit [-h] [-w WHO] [-y WHY] [-s] [-i] [-u [ID]] [command]

With no command, list running inhibitors.

positional arguments:
  command               Command to run

optional arguments:
  -h, --help            show this help message and exit
  -w WHO, --who WHO     Set who is inhibiting
  -y WHY, --why WHY     Set why this inhibitor is running
  -s, --stop            Stop running inhibitors
  -i, --inhibit         Inhibit without a command
  -u [ID], --uninhibit [ID]
                        Uninhibit last inhibitor or by ID

See sessiond-inhibit(1) for more information.

See sessiond-dbus(8) for descriptions of inhibitor-related methods.