Files
chandra/components/starfield/gen/interface/chandra/desktop/desktop-module/README.md
T
Claude 0f71779819
CI / test (push) Failing after 30s
Desktop modules: a wasm module can fill the desktop, with Icon Desktop and Live Starfield
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
2026-11-26 00:30:32 +00:00

1.4 KiB

Optional export that turns a module into a desktop module: instead of a box in the panel it owns the desktop itself, the whole output behind the windows (see docs/desktop-modules.md).

A desktop module is still a plasmoid (it exports plasmoid as well, and may export module-config and import any capability a panel module can), so the same sandbox, draw ops and capability grants apply. What changes is how the shell drives it:

  • plasmoid.render is called with the output's full size (and again with the new size when the output is resized), in desktop coordinates: (0, 0) is the output's top-left corner. The panel and windows are drawn on top; the module draws the whole area.
  • plasmoid.on-event gets the pointer (move, press, release, leave) only where no window, panel, popup or menu covers the desktop, and keys only while the desktop has keyboard focus (after a click on it, until a window is focused: it then gets focus-lost). A right-click on the empty desktop always opens the shell's desktop menu (module settings, system settings), never reaches the module.
  • plasmoid.popup and plasmoid.info's size fields are not used.
  • Hidden settings (a module-config item with an empty label) are saved by the shell in state.edn whenever their value changes after an event, and handed back at the next load: that is how a desktop module keeps state such as icon positions.