Launcher: Reload session, and Log out moves in from its own module
CI / test (push) Failing after 17s
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:
37 files changed
+420
-827
No files matched your search
@@ -560,6 +560,8 @@ test "a panel saved with the old 12-hour clock gets the Digital Clock with the s
|
||||
assert_eq(a.module_setting("clock-digital12", "date"), None)
|
||||
let panel = @utf8.decode_lossy(@sys.read_file_bytes(dir + "/panel.edn"))
|
||||
assert_true(panel.contains("\"clock-digital\"") && !panel.contains("clock-digital12"))
|
||||
// The old Log out button became the launcher, which has Log out now.
|
||||
assert_true(panel.contains("\"launcher\"") && !panel.contains("logout"))
|
||||
assert_true(panel.contains(":version 2"))
|
||||
// Only once: a format chosen afterwards sticks across restarts.
|
||||
a.set_module_setting(a.slot_of("clock-digital"), "format", "24-hour")
|
||||
@@ -1040,31 +1042,56 @@ test "dragging a floating window's corner resizes it" {
|
||||
assert_eq(g1.h, g0.h - 40)
|
||||
}
|
||||
|
||||
///| Centre of session-row button `i` (0 Reload, 1 Log out, 2 Suspend, 3 Restart, 4 Power off)
|
||||
/// in the launcher's open popup (geometry from lib/launcher: 5 buttons in a 44 px row at the
|
||||
/// bottom, 8 px margins, 4 px gaps).
|
||||
fn launcher_button(comp : @host.ChandraCompositor, i : Int) -> (Int, Int) {
|
||||
let pr = comp.shell.slot_popup_rect(comp.shell.slot_of("launcher"))
|
||||
(pr.x + 8 + i * 65 + 30, pr.y + pr.h - 44 + 6 + 15)
|
||||
}
|
||||
|
||||
///|
|
||||
test "the logout button asks first, then ends the session" {
|
||||
let comp = new_comp("logout")
|
||||
let slot = comp.shell.slot_of("logout")
|
||||
test "the launcher's Log out asks first, then ends the session" {
|
||||
let comp = new_comp("launcher-logout")
|
||||
let slot = comp.shell.slot_of("launcher")
|
||||
assert_true(comp.shell.slot_rect(slot).w > 0) // it is in the default panel
|
||||
assert_false(comp.quit_requested)
|
||||
// A click opens the popup; nothing is requested yet.
|
||||
click_module(comp, "logout", 1U)
|
||||
let pr = comp.shell.slot_popup_rect(slot)
|
||||
assert_true(pr.w > 0)
|
||||
// The old Log out button is gone from the default panel.
|
||||
assert_false(comp.shell.slots().map(s => comp.shell.slot_module(s)).contains("logout"))
|
||||
click_module(comp, "launcher", 1U)
|
||||
assert_true(comp.shell.slot_popup_rect(slot).w > 0)
|
||||
ignore(comp.compose_frame())
|
||||
// The first click on Log out only arms it.
|
||||
let (x, y) = launcher_button(comp, 1)
|
||||
click_at(comp, x, y, 5U)
|
||||
ignore(comp.compose_frame())
|
||||
assert_false(comp.quit_requested)
|
||||
// Cancel (second row) closes it without logging out.
|
||||
click_at(comp, pr.x + 20, pr.y + 6 + 30 + 5, 5U)
|
||||
assert_eq(comp.shell.slot_popup_rect(slot).w, 0)
|
||||
assert_false(comp.quit_requested)
|
||||
// Open again and choose Log out (first row).
|
||||
click_module(comp, "logout", 10U)
|
||||
let pr2 = comp.shell.slot_popup_rect(slot)
|
||||
assert_true(pr2.w > 0)
|
||||
click_at(comp, pr2.x + 20, pr2.y + 6 + 5, 15U)
|
||||
assert_true(comp.shell.slot_popup_rect(slot).w > 0)
|
||||
assert_true(comp.shell.slot_popup_texts(slot).iter().any(t => t.0 == "Click Log out again to confirm"))
|
||||
// The second ends the session.
|
||||
let (x, y) = launcher_button(comp, 1)
|
||||
click_at(comp, x, y, 10U)
|
||||
ignore(comp.compose_frame())
|
||||
assert_true(comp.quit_requested)
|
||||
}
|
||||
|
||||
///|
|
||||
test "the launcher's Reload reloads every panel module in place" {
|
||||
let comp = new_comp("launcher-reload")
|
||||
let before = comp.shell.slots().map(s => comp.shell.slot_module(s))
|
||||
let slots_before = comp.shell.slots()
|
||||
click_module(comp, "launcher", 1U)
|
||||
ignore(comp.compose_frame())
|
||||
let (x, y) = launcher_button(comp, 0)
|
||||
click_at(comp, x, y, 5U)
|
||||
ignore(comp.compose_frame())
|
||||
assert_false(comp.quit_requested)
|
||||
// Same modules in the same order, each a fresh instance (new slot ids).
|
||||
assert_eq(comp.shell.slots().map(s => comp.shell.slot_module(s)), before)
|
||||
for s in comp.shell.slots() {
|
||||
assert_false(slots_before.contains(s))
|
||||
}
|
||||
}
|
||||
|
||||
///| Contents of state.edn in the scratch config dir.
|
||||
fn read_state_edn() -> String {
|
||||
let dir = match @sys.getenv("XDG_CONFIG_HOME") {
|
||||
|
||||
Reference in new issue
Block a user