Desktop modules: a wasm module can fill the desktop, with Icon Desktop and Live Starfield
CI / test (push) Failing after 30s

A module that exports chandra:desktop/desktop-module (wit/desktop.wit) owns the desktop behind
the windows instead of a box in the panel: same sandbox, draw ops and capabilities, drawn at the
output's full size and re-rendered on resize. It gets pointer and scroll events only on the empty
desktop (windows, panel, popups and menus always win; a drag stays with the module until
release), keys only while the desktop has focus, and can draw over the wallpaper or replace it.
Its tick() asks for animation frames only while something moves; the main loop sleeps until the
next one (wake_timeout), and frames pause while a window covers the desktop, so an idle desktop
module costs nothing.

Settings > Desktop gets "On the desktop": Wallpaper only, Clock card (default) or any installed
desktop module, saved in state.edn as :desktop, loaded at login and reloaded by chandra-ctl
reload. Right-click the empty desktop for Module settings and System settings. Hidden settings
(empty label) are persisted by the shell, which is how Icon Desktop keeps icon positions.

Samples: Icon Desktop (click to launch, drag to arrange, keyboard navigation, count and size
settings) and Live Starfield (pointer steers, click or Space warps, wheel sets speed). Served by
all hosts: compositor/wasm (native + MoonBit wasmhost) and Rust host-wasm. Docs in
docs/desktop-modules.md; tests in compositor/host/desktop_test.mbt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgf1SwPMHVfLUbJKsB
This commit is contained in:
Claude committed 2026-11-26 00:30:32 +00:00
1 parent 30f5e88639
commit 0f71779819
79 files changed
+4591 -113

No files matched your search

+12 -3
View File
@@ -1472,13 +1472,20 @@ test "the settings module lists the wallpapers and switches the desktop to the o
let pr = comp.shell.slot_popup_rect(slot)
assert_true(pr.h >= 40 + 6 * 28) // heading and one row per wallpaper below the tab bar
assert_eq(comp.shell.wallpaper_sel, 0)
// The wallpaper rows follow what fills the desktop (wallpaper only, clock card, modules).
let row_y = fn(name : String) {
match comp.shell.slot_popup_texts(slot).iter().find_first(t => t.0 == name) {
Some(t) => pr.y + t.2
None => -1
}
}
// Third wallpaper: Starfield. The list stays open and the backdrop is drawn anew.
let star = click_wallpaper_ops(comp, pr.x + 40, pr.y + 40 + 3 * 28 + 13, 5U)
let star = click_wallpaper_ops(comp, pr.x + 40, row_y("Starfield"), 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 + 40 + 5 * 28 + 13, 10U), 1)
assert_eq(click_wallpaper_ops(comp, pr.x + 40, row_y("Solid"), 10U), 1)
assert_eq(comp.shell.wallpaper_sel, 4)
comp.shell.key_down("Escape")
ignore(comp.compose_frame())
@@ -1682,7 +1689,9 @@ test "open_settings opens the settings module on the tab asked for" {
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
// "On the desktop" and its choices (wallpaper only, clock card, the two desktop modules), then
// the Wallpaper heading and the five wallpapers.
assert_eq(pr.h, 40 + (1 + 4 + 6) * 28 + 6)
assert_true(comp.shell.open_settings(Session))
ignore(comp.compose_frame())
assert_eq(comp.shell.slot_popup_rect(slot).h, 40 + 4 * 28 + 6) // the four settings