Settings module: Session, Desktop and Panel tabs; the module manager moves in
CI / test (push) Failing after 15s

- The settings popup gets a tab bar, split by where things live: Session (the switches), Desktop
  (what is drawn on the desktop: the wallpaper list under a "Wallpaper" heading) and Panel (what
  the module manager showed: modules in the panel to remove, modules to add, Browse...).
  Left/Right or 1/2/3 switch tabs; it reopens on the tab it was left on. Modules can't be placed
  on the desktop yet (every wasm module lives in the panel; the desktop card is built in), so
  the Desktop tab has no module section until they can.
- The standalone module-manager module and its world are removed; the settings module imports
  `modules`. Saved panels listing "module-manager" get the settings module in its place.
- DesktopShell::open_settings(SettingsTab) opens the settings module on a tab (loading it into the
  panel if needed), for the panel menu and "System settings" entries; the wasm picker
  ("Modules..." in the panel menu) is open_settings(Panel).
- Tests: the native picker test drives the Panel tab, the wallpaper and switch tests go through
  the tabs, an open_settings test; the wasm and host-wasm module tests use the settings module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgxf6exeYrDGcy4WW3
This commit is contained in:
Claude committed 2026-11-25 18:50:57 +00:00
1 parent ee019ecbaa
commit 0e6a1257e1
20 files changed
+316 -917

No files matched your search

+45 -29
View File
@@ -393,27 +393,29 @@ test "the panel is saved to panel.edn and restored" {
}
///|
test "the wasm picker opens the module manager, which loads and unloads modules" {
test "the wasm picker opens the settings module's Panel tab, which loads and unloads modules" {
let comp = new_comp("manager")
// The manager is not in the default panel: the picker loads it on demand.
// The settings module is in the default panel; the standalone module manager is gone.
assert_eq(comp.shell.slot_of("module-manager"), "")
let mgr = comp.shell.slot_of("session-settings")
assert_true(mgr != "")
let n0 = comp.shell.slots().length()
// Right-click empty panel space (the margin): the menu offers the module manager.
// Right-click empty panel space (the margin): the menu offers the module list.
let panel = comp.shell.panel_rect
click_at(comp, 1, panel.y + 5, 1U, btn=273U)
assert_true(comp.shell.menu_open)
assert_eq(comp.shell.menu_rows[0].label, "Module manager...")
assert_eq(comp.shell.menu_rows[0].label, "Modules...")
let m = comp.shell.menu_rect
click_at(comp, m.x + m.w / 2, m.y + 26 + 14, 10U)
assert_eq(comp.shell.slots().length(), n0 + 1)
let mgr = comp.shell.slot_of("module-manager")
assert_true(mgr != "")
assert_eq(comp.shell.slots().length(), n0) // nothing new was loaded for it
ignore(comp.compose_frame())
let pr = comp.shell.slot_popup_rect(mgr)
assert_true(pr.w > 0) // the picker opened the app's popup
// Rows: header(24), one per loaded module (28), header(24), one per available module (28), browse.
assert_true(pr.w > 0) // the picker opened the popup
// Rows below the tab bar (40): heading, one per loaded module, heading, one per available
// module, browse; 28 each.
let loaded = comp.shell.slots().length()
let avail_y = fn(k : Int) { pr.y + 4 + 24 + loaded * 28 + 24 + k * 28 + 14 }
assert_true(pr.h >= 40 + (loaded + 3) * 28)
let avail_y = fn(pr : @scene.Rect, k : Int) { pr.y + 40 + (loaded + 2 + k) * 28 + 13 }
let mut k_bin = -1
for k = 0; k < comp.shell.catalog.length(); k = k + 1 {
if comp.shell.catalog[k].id == "clock-binary" {
@@ -422,10 +424,11 @@ test "the wasm picker opens the module manager, which loads and unloads modules"
}
assert_true(k_bin >= 0)
assert_eq(comp.shell.slot_of("clock-binary"), "")
click_at(comp, pr.x + 40, avail_y(k_bin), 20U) // select it: it is loaded into the panel
click_at(comp, pr.x + 40, avail_y(pr, k_bin), 20U) // select it: it is loaded into the panel
assert_true(comp.shell.slot_of("clock-binary") != "")
assert_eq(comp.shell.slots().length(), loaded + 1)
// The popup stays open; click the loaded module's row to unload it again.
// The popup stays open (it grew a row); click the loaded module's row to unload it again.
ignore(comp.compose_frame())
let pr2 = comp.shell.slot_popup_rect(mgr)
assert_true(pr2.w > 0)
let slots = comp.shell.slots()
@@ -435,14 +438,15 @@ test "the wasm picker opens the module manager, which loads and unloads modules"
idx = i
}
}
click_at(comp, pr2.x + 40, pr2.y + 4 + 24 + idx * 28 + 14, 30U)
click_at(comp, pr2.x + 40, pr2.y + 40 + (1 + idx) * 28 + 13, 30U)
assert_eq(comp.shell.slot_of("clock-binary"), "")
assert_eq(comp.shell.slots().length(), loaded)
// The manager is just another module: it can be removed too, and the picker brings it back.
// The settings module is just another module: it can be removed too, and the picker brings it
// back.
assert_true(comp.shell.unload_slot(mgr))
assert_eq(comp.shell.slot_of("module-manager"), "")
assert_eq(comp.shell.slot_of("session-settings"), "")
assert_true(comp.shell.open_module_manager())
assert_true(comp.shell.slot_of("module-manager") != "")
assert_true(comp.shell.slot_of("session-settings") != "")
}
///|
@@ -1140,22 +1144,21 @@ test "the settings module lists the wallpapers and switches the desktop to the o
assert_true(comp.shell.slot_rect(slot).w > 0) // it is in the default panel
assert_eq(comp.shell.slot_of("wallpaper"), "") // the standalone chooser is gone
assert_eq(comp.shell.wallpaper_sel, 0)
// A click opens the list; nothing changes yet. The wallpapers follow the three settings and a
// "Wallpaper" heading, so the first is row 4.
// A click opens the popup on its Session tab; the Desktop tab (the second of three 96 px
// tabs) lists the wallpapers below a heading. Nothing changes yet.
click_module(comp, "session-settings", 1U)
let p0 = comp.shell.slot_popup_rect(slot)
click_at(comp, p0.x + 6 + 96 + 48, p0.y + 6 + 14, 3U)
let pr = comp.shell.slot_popup_rect(slot)
assert_true(pr.h >= 6 * 2 + (4 + 5) * 30) // one row per setting and wallpaper, and the heading
assert_eq(comp.shell.wallpaper_sel, 0)
// The heading does nothing.
click_at(comp, pr.x + 40, pr.y + 6 + 3 * 30 + 5, 3U)
assert_true(pr.h >= 40 + 6 * 28) // heading and one row per wallpaper below the tab bar
assert_eq(comp.shell.wallpaper_sel, 0)
// Third wallpaper: Starfield. The list stays open and the backdrop is drawn anew.
let star = click_wallpaper_ops(comp, pr.x + 40, pr.y + 6 + (4 + 2) * 30 + 5, 5U)
let star = click_wallpaper_ops(comp, pr.x + 40, pr.y + 40 + 3 * 28 + 13, 5U)
assert_eq(comp.shell.wallpaper_sel, 2)
assert_true(star > 0)
assert_true(comp.shell.slot_popup_rect(slot).w > 0)
// Last row: Solid, a single fill. Escape then closes the list.
assert_eq(click_wallpaper_ops(comp, pr.x + 40, pr.y + 6 + (4 + 4) * 30 + 5, 10U), 1)
assert_eq(click_wallpaper_ops(comp, pr.x + 40, pr.y + 40 + 5 * 28 + 13, 10U), 1)
assert_eq(comp.shell.wallpaper_sel, 4)
comp.shell.key_down("Escape")
ignore(comp.compose_frame())
@@ -1269,17 +1272,17 @@ test "the settings module flips the session settings from its popup" {
// A click opens the list of switches; nothing changes yet.
click_module(comp, "session-settings", 1U)
let pr = comp.shell.slot_popup_rect(slot)
assert_true(pr.h >= 6 * 2 + 3 * 30) // one row per setting
assert_true(pr.h >= 40 + 3 * 28) // one row per setting below the tab bar
assert_true(comp.shell.restore_session)
// First row: "Reopen windows at login" goes off, and on again with a second click.
click_at(comp, pr.x + 40, pr.y + 6 + 5, 5U)
click_at(comp, pr.x + 40, pr.y + 40 + 13, 5U)
assert_false(comp.shell.restore_session)
assert_true(comp.shell.remember_windows)
assert_true(comp.shell.slot_popup_rect(slot).w > 0) // the list stays open
click_at(comp, pr.x + 40, pr.y + 6 + 5, 10U)
click_at(comp, pr.x + 40, pr.y + 40 + 13, 10U)
assert_true(comp.shell.restore_session)
// Second row: "Remember window positions"; then Down and Enter flip it back from the keyboard.
click_at(comp, pr.x + 40, pr.y + 6 + 30 + 5, 15U)
click_at(comp, pr.x + 40, pr.y + 40 + 28 + 13, 15U)
assert_false(comp.shell.remember_windows)
comp.shell.key_down("Enter")
ignore(comp.compose_frame())
@@ -1287,7 +1290,7 @@ test "the settings module flips the session settings from its popup" {
assert_true(comp.shell.restore_session)
// Third row: Dark mode. Off switches the shell, panel and decorations to the light theme.
assert_eq(comp.theme.name, "Moon Night")
click_at(comp, pr.x + 40, pr.y + 6 + 2 * 30 + 5, 20U)
click_at(comp, pr.x + 40, pr.y + 40 + 2 * 28 + 13, 20U)
assert_false(comp.shell.dark_mode)
assert_eq(comp.theme.name, "Moon Day")
assert_eq(comp.shell.tokens.name, "Moon Day")
@@ -1351,3 +1354,16 @@ test "session settings are saved to state.edn and restored, and take effect" {
assert_false(read_state_edn().contains(":theme"))
}
}
///|
test "open_settings opens the settings module on the tab asked for" {
let comp = new_comp("opensettings")
let slot = comp.shell.slot_of("session-settings")
assert_true(comp.shell.open_settings(Desktop))
ignore(comp.compose_frame())
let pr = comp.shell.slot_popup_rect(slot)
assert_eq(pr.h, 40 + 6 * 28 + 6) // the Wallpaper heading and the five wallpapers
assert_true(comp.shell.open_settings(Session))
ignore(comp.compose_frame())
assert_eq(comp.shell.slot_popup_rect(slot).h, 40 + 3 * 28 + 6) // the three settings
}