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

+7
View File
@@ -180,6 +180,8 @@ pub(all) struct MenuRow {
pub(all) struct DesktopShell {
apps : Array[@types.AppEntry]
exec : Map[String, String]
/// Lower-cased StartupWMClass -> desktop file id, for apps whose windows' app id differs.
wm_classes : Map[String, String]
/// Wayland socket handed to launched apps as WAYLAND_DISPLAY.
display : String
/// Panel modules in panel order; a module with `stretch` splits the panel into a left and a right group.
@@ -255,7 +257,11 @@ pub(all) struct DesktopShell {
pub fn DesktopShell::new(display : String) -> DesktopShell {
let apps : Array[@types.AppEntry] = []
let exec : Map[String, String] = {}
let wm_classes : Map[String, String] = {}
for a in scan_desktop_apps() {
if a.wm_class.length() > 0 {
wm_classes.set(a.wm_class.to_lower(), a.id)
}
let glyph = match a.name.to_array().get(0) {
Some(c) => c.to_string().to_upper()
None => "?"
@@ -267,6 +273,7 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
let sh : DesktopShell = {
apps,
exec,
wm_classes,
display,
widgets: [],
next_slot: 1,