Launcher: Reload session, and Log out moves in from its own module
CI / test (push) Failing after 17s

The Application Launcher's menu now ends in a session row: Reload, Log out, Suspend, Restart,
Power off. Log out, Restart and Power off take a second click on the same button (a status line
says "Click Log out again to confirm"); Reload and Suspend act at once.

- Reload calls the new session.reload, which reaches the shell as the ReloadSession request
  (native stub: request 8 with n 1; host plasmoids.wit: reload-session; host-wasm: Req::ReloadSession)
  and runs DesktopShell::reload_modules(""): every panel module again from disk, in place, with
  its settings. Windows and apps keep running. The compositor redraws the whole frame after it.
- Suspend / Restart / Power off use the power capability, the same calls as Settings > Power.
- The standalone logout module is gone (component, world, components.txt). Saved panels drop
  "logout", or get the launcher in its place when they had none; panel.edn is rewritten without
  it. A stale logout.wasm is hidden from Settings > Panel (retired_modules).
- Tests: lib/launcher session row, shell migrate_panel, host input tests for Log out and Reload,
  host-wasm launcher session row; control_test uses inspector.wasm instead of logout.wasm.
- README and docs/reloading.md describe the session row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjKUnSS3D92ThigvJf
This commit is contained in:
Claude committed 2026-11-25 21:01:17 +00:00
1 parent 68164ff75e
commit 99c6c66726
37 files changed
+420 -827

No files matched your search

+38 -6
View File
@@ -14,7 +14,7 @@
///| Modules loaded into a fresh panel, in order. `tasks` stretches, so what follows it packs right.
let default_panel : Array[String] = [
"launcher", "inspector", "layout", "tasks", "moon-disc", "network", "clock-digital", "screenshot",
"session-settings", "logout",
"session-settings",
]
///| A fresh panel's modules: the defaults, plus the battery before the clock on a machine that
@@ -44,7 +44,13 @@ test "a fresh panel gets the battery module only on a machine with a battery" {
/// works everywhere a module is named (saved panels, load_module), it is just never listed:
/// a stale build/components/clock-digital12.wasm or an old installed copy stays out of the picker.
/// - clock-digital12, the 12-hour clock, is the Digital Clock, which now starts in 12-hour mode.
let retired_modules : Map[String, String] = { "clock-digital12": "clock-digital" }
/// - logout, the Log out button, is the Application Launcher's session row (Reload, Log out,
/// Suspend, Restart, Power off). A saved panel drops it, or gets the launcher in its place when
/// it had none (migrate_panel).
let retired_modules : Map[String, String] = {
"clock-digital12": "clock-digital",
"logout": "launcher",
}
///| The id a module goes by now ("clock-digital12" -> "clock-digital").
fn current_module_id(id : String) -> String {
@@ -214,16 +220,22 @@ fn wall_secs() -> Int {
///| Panels saved before the wallpaper chooser and the module manager moved into the settings
/// module list "wallpaper" or "module-manager": the settings module takes the first one's place
/// (a panel that already has it just drops them). Retired modules (clock-digital12) become
/// the module that replaced them.
/// (a panel that already has it just drops them). The Log out button moved into the launcher the
/// same way: "logout" becomes the launcher when the panel has none, else it is dropped. Other
/// retired modules (clock-digital12) become the module that replaced them.
fn migrate_panel(entries : Array[String]) -> Array[String] {
let has_settings = entries.contains("session-settings")
let has_launcher = entries.contains("launcher")
let out : Array[String] = []
for e in entries {
if e == "wallpaper" || e == "module-manager" {
if !has_settings && !out.contains("session-settings") {
out.push("session-settings")
}
} else if e == "logout" {
if !has_launcher && !out.contains("launcher") {
out.push("launcher")
}
} else {
out.push(current_module_id(e))
}
@@ -233,7 +245,7 @@ fn migrate_panel(entries : Array[String]) -> Array[String] {
///|
test "a saved panel's wallpaper button becomes the settings module" {
assert_eq(migrate_panel(["launcher", "wallpaper", "logout"]), ["launcher", "session-settings", "logout"])
assert_eq(migrate_panel(["launcher", "wallpaper", "logout"]), ["launcher", "session-settings"])
assert_eq(migrate_panel(["wallpaper", "session-settings"]), ["session-settings"])
assert_eq(migrate_panel(["module-manager", "clock", "wallpaper"]), ["session-settings", "clock"])
assert_eq(migrate_panel(["clock"]), ["clock"])
@@ -241,11 +253,23 @@ test "a saved panel's wallpaper button becomes the settings module" {
///|
test "a saved panel's 12-hour clock becomes the digital clock" {
assert_eq(migrate_panel(["tasks", "clock-digital12", "logout"]), ["tasks", "clock-digital", "logout"])
assert_eq(migrate_panel(["tasks", "clock-digital12", "logout"]), ["tasks", "clock-digital", "launcher"])
assert_eq(current_module_id("clock-digital12"), "clock-digital")
assert_eq(current_module_id("clock-binary"), "clock-binary")
}
///|
test "a saved panel's Log out button folds into the launcher" {
// The launcher's session row has Log out now: the old button is dropped...
assert_eq(migrate_panel(["launcher", "tasks", "session-settings", "logout"]), [
"launcher", "tasks", "session-settings",
])
// ...or becomes the launcher on a panel without one, so Log out stays reachable.
assert_eq(migrate_panel(["tasks", "logout"]), ["tasks", "launcher"])
assert_eq(migrate_panel(["logout", "launcher"]), ["launcher"])
assert_false(default_panel.contains("logout"))
}
///| Load the panel on first use: the saved layout if there is one, else the default modules.
fn DesktopShell::ensure_booted(self : DesktopShell) -> Unit {
if self.booted {
@@ -265,6 +289,9 @@ fn DesktopShell::ensure_booted(self : DesktopShell) -> Unit {
self.migrate_module_cfg(old)
write_panel_file(entries)
}
// A renamed or folded module (the Log out button, now in the launcher): rewrite the file so
// the old name is gone for good.
Some(old) if old != entries => write_panel_file(entries)
_ => ()
}
for e in entries {
@@ -743,6 +770,11 @@ fn DesktopShell::process_requests(self : DesktopShell) -> Unit {
Some(FocusWindow(n)) => self.actions.push(FocusWindow(n.to_int64().to_uint64()))
Some(SetLayout(m)) => self.actions.push(SetLayout(m))
Some(Logout) => self.actions.push(Logout)
// The launcher's Reload: every panel module again from disk, in place.
Some(ReloadSession) => {
ignore(self.reload_modules(""))
self.actions.push(ModulesReloaded)
}
Some(SetWallpaper(i)) => self.set_wallpaper(i)
Some(SetSessionSetting(i, on)) => self.set_session_setting(i, on)
Some(Screenshot(code)) => self.actions.push(Screenshot(code))