Restore the session on login: reopen the windows the last session ended with
CI / test (push) Failing after 20s

- state.edn gets :session [{:app "foot"} {:app "org.gnome.Nautilus" :minimized true}]: the open
  windows by app id, in opening order, with whether each was minimized or maximized. Dialogs
  (xdg_toplevel.set_parent, now tracked by the Wayland server) are left out.
- Written at the end of a session (logout, or the display/window going away) and, against
  crashes, whenever the set of windows changes and then holds for 3 s; that delay also keeps a
  shutdown, where apps die a moment before the compositor, from saving an empty desktop.
- At start (both the native binary and the wasm compositor) each saved app is launched through
  its .desktop file: the app id is matched to the desktop file id, StartupWMClass (now parsed),
  case-insensitively, or by its last dotted part. Restored apps don't count as recent launches.
  A launched app stays in the session until its window shows up (30 s at most), and that window
  gets its minimized/maximized state back; placement is the existing layout mode and per-app
  floating geometry.
- --no-restore, or :restore-session false in state.edn, starts with an empty desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjkHnYqipToGkWFC9P
This commit is contained in:
Claude committed 2026-11-25 18:31:31 +00:00
1 parent f7f90e1c41
commit 46780c399b
10 files changed
+435 -2

No files matched your search

+8
View File
@@ -9,6 +9,7 @@ fn main {
let widgets : Array[String] = []
let mut windowed = false
let mut drm = false
let mut restore = true
let mut width = 1280
let mut height = 720
@@ -27,6 +28,9 @@ fn main {
} else if a == "--drm" {
drm = true
i = i + 1
} else if a == "--no-restore" {
restore = false // don't reopen the apps of the last session
i = i + 1
} else if a == "--widget" && i + 1 < args.length() {
widgets.push(args[i + 1])
i = i + 2
@@ -117,6 +121,9 @@ fn main {
None => ()
}
println("chandra compositor listening on " + socket_path + " (wasi-gfx surface active)")
if restore {
ignore(comp.restore_session()) // reopen the windows the last session ended with
}
while true {
comp.step()
if comp.quit_requested {
@@ -169,6 +176,7 @@ fn main {
}
@sys.sleep_ms(16)
}
comp.save_session() // what is open now is reopened at the next start
match kms {
Some(k) => k.close()
None => ()