Skip to content

Upgrading in place ​

A session started with --holder can move to a new lys-wm binary without logging out:

sh
lys-wmctl upgrade "$(command -v lys-wm)"

If the session already runs that file, under any path, nothing happens and the command reports "unchanged": true.

Enabling it ​

The lys-wm display manager session starts lys-wm --systemd --holder. A session started another way needs --holder added to its command, then a new login:

sh
lys-wm --systemd --holder

Without it lys-wm is one process that talks to logind itself, and lys-wmctl upgrade is refused. The feature is tested on virtio-gpu in a VM; on other GPUs, NVIDIA especially, try it when losing the session is acceptable.

Under --holder each session has two processes: the holder, which keeps the logind session and is never replaced, and the compositor. lys-wmctl upgrade reports the new compositor's pid.

What happens ​

Windows, workspaces, layout and clients stay. The new binary reads the config, so this also applies config changes the old binary could not read. On success lys-wmctl upgrade prints the new pid, binary, and the clients and windows kept, and exits 0.

On any failure the session stays on the old binary, unchanged, and the command prints why and exits 1. The new binary must use the same handover format, accept the config, rebuild every client and present a frame before the old one lets go.

Outputs keep their mode unless the config changes it; changes made with wlr-randr since the last reload are lost, as on a reload.

Following the system ​

The NixOS and home-manager modules add the user unit lys-wm-upgrade.service. It is wanted by lys-wm-session.target and runs

sh
lys-wmctl upgrade --notice <the package>/bin/lys-wm

At login this changes nothing. The unit names the package's store path, so a switch to a generation with another lys-wm changes the unit and restarts it, and the session moves to that lys-wm.

The session's clients follow the compositor. programs.lys-wm.clients maps their user units to the packages they run; lys-shell's modules add its shell and portal units there and stop the switch from restarting them itself. A change to any of those packages also restarts lys-wm-upgrade.service. Once the session runs the new lys-wm, the unit restarts each client whose process does not run the package its unit names. The shell keeps drawing through the handover and comes back on the new build after it, so the shell and the compositor come from the same generation.

When the upgrade is refused or fails, the session stays on its lys-wm and its clients stay on the build that goes with it. The unit fails with the reason in its journal (journalctl --user -u lys-wm-upgrade). A red notice on every output says which lys-wm did not take over and why, until dismissconfignotice hides it. Fix the reason and run systemctl --user restart lys-wm-upgrade, or log out and in, to move to the new lys-wm.

The unit never passes --drop-x11. Once any X11 program has run, Xwayland refuses the automatic upgrade. PipeWire's X11 bell module counts as one. To upgrade anyway, quit the X11 programs and run lys-wmctl upgrade --drop-x11 <the package>/bin/lys-wm, or log in again.

What clients see ​

Only things a compositor may do at any time:

  • Popups and menus close.
  • Clipboard and primary selection are cleared; clipboard managers set them again.
  • Keyboard and pointer focus leave and return.
  • Screen captures and screencasts stop; a screencast must be restarted. Gamma and output power controls fail, so night-light tools reapply.
  • Foreign-toplevel and workspace handles close and reappear; taskbars see every window close and reopen in one update.
  • Input methods are told they are unavailable and must bind again; client hotkeys are revoked and focus grabs cleared.
  • Tablets and tablet tools are removed and re-added.
  • A window may briefly show its last committed frame.

What refuses an upgrade ​

Each reason is reported and nothing changes:

  • The session is locked.
  • A drag is in progress.
  • The session is not on the active VT.
  • Any virtual output created with lys-wmctl output create exists.
  • A client exports or imports a window across clients (xdg-foreign, as portal file choosers do while open), holds a sandbox listener or runs inside a sandbox (security-context), or uses wl_shell.
  • A client holds a surface whose buffer it destroyed (rare; retrying a moment later usually works).
  • A surface commit is still pending after 5 seconds, e.g. on a GPU fence that never signals.
  • Xwayland is running. Quit the X11 programs and pass --drop-x11, which ends Xwayland; the next X11 program starts a new one on the same DISPLAY. Xwayland keeps running once started, so any session that ran an X11 program needs the flag.

Released under the MIT License.