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

+23
View File
@@ -94,6 +94,8 @@ struct ToplevelState {
mut min_w : Int
mut min_h : Int
mut opened_sent : Bool
/// xdg_toplevel.set_parent named another toplevel: a dialog or tool window of its app.
mut has_parent : Bool
/// Set for xdg_popup surfaces (they live in `toplevels` so input routing is shared).
popup_parent : UInt64?
}
@@ -839,6 +841,7 @@ fn WaylandServer::dispatch_msg(
min_w: 160,
min_h: 120,
opened_sent: false,
has_parent: false,
popup_parent: None,
})
self.win_to_client.set(wid, c.client_id)
@@ -884,6 +887,7 @@ fn WaylandServer::dispatch_msg(
min_w: 1,
min_h: 1,
opened_sent: true,
has_parent: true,
popup_parent: Some(parent_wid),
})
self.win_to_client.set(wid, c.client_id)
@@ -945,6 +949,9 @@ fn WaylandServer::dispatch_msg(
c.objects.remove(obj_id)
send_delete_id(c, obj_id)
events.push(ToplevelClosed(wid))
} else if opcode == 1U {
// set_parent(parent: object or null)
tl.has_parent = reader.u32() != 0U
} else if opcode == 2U {
// set_title
tl.title = reader.str()
@@ -1135,6 +1142,22 @@ fn WaylandServer::find_client(self : WaylandServer, cid : UInt) -> ClientConn? {
None
}
///| Whether a window is a dialog or tool window of another one (xdg_toplevel.set_parent).
pub fn WaylandServer::toplevel_has_parent(self : WaylandServer, win_id : UInt64) -> Bool {
match self.win_to_client.get(win_id) {
Some(cid) =>
match self.find_client(cid) {
Some(c) =>
match c.toplevels.get(win_id) {
Some(tl) => tl.has_parent
None => false
}
None => false
}
None => false
}
}
///| Send xdg_toplevel.configure + xdg_surface.configure to a client window.
pub fn WaylandServer::send_toplevel_configure(
self : WaylandServer,