Wallpaper chooser panel module, and four new wallpapers
CI / test (push) Failing after 17s

- New 'wallpaper' capability (wit/capabilities.wit: wallpapers, current-wallpaper, set-wallpaper)
  and 'wallpaper' panel module: a button whose popup lists the wallpapers with the current one
  ticked. Clicking a row switches the desktop at once (the list stays open to compare); Enter
  picks the highlighted row, Escape or a click elsewhere closes. In the default panel, before
  Log out.
- lib/shell: render_wallpaper(screen, tokens, index) with Plasma glow (the old background),
  Aurora, Starfield, Dusk and Solid, all draw ops; the themed ones follow a theme swap.
- The shell draws the chosen one (the renderer's wallpaper cache redraws it on change) and
  saves it in state.edn as :wallpaper (:aurora, ...); unknown names fall back to the default.
- Served by both hosts: wasmer stub (native) and host-wasm (publish-wallpaper, wallpapers
  table 5, set-wallpaper request).
- Tests: lib/shell wallpaper test, host-wasm module test, native end-to-end test (open, pick,
  Escape) and a state.edn round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhM8CTYpe2XVYTFQGn
This commit is contained in:
Claude authored and V committed 2026-11-25 17:08:39 +00:00
1 parent 7248e0ca6e
commit 5dfe34027b
37 files changed
+1311 -78

No files matched your search

+29 -4
View File
@@ -4,7 +4,8 @@
/// {:layout :tiling ; the Tile | Float switcher: :tiling, :monocle or :floating
/// :recent ["foot" "dolphin"] ; the launcher's recently started apps, newest first
/// :windows {"foot" {:x 80 :y 60 :w 640 :h 480}} ; floating windows' last place, by app id
/// :desktop-card {:x 900 :y 24}} ; where the desktop card was dragged to (absent: default spot)
/// :desktop-card {:x 900 :y 24} ; where the desktop card was dragged to (absent: default spot)
/// :wallpaper :aurora} ; the wallpaper module's choice (absent: :plasma-glow)
///
/// Saving merges into what is already in the file, so keys this build doesn't know (a future
/// widget's state, hand-written notes) survive. Everything is a no-op unless `persist` is on
@@ -19,6 +20,8 @@ pub(all) struct SavedState {
/// Top-left of the desktop card, when it was moved.
desk : (Int, Int)?
windows : Map[String, (Int, Int, Int, Int)]
/// Index into `@libshell.wallpaper_names`.
wallpaper : Int?
}
///|
@@ -30,7 +33,10 @@ fn state_path() -> String {
let layout_names : Array[String] = ["tiling", "monocle", "floating"]
///| The keys this build owns; everything else in the file is kept as it is.
let owned_keys : Array[String] = ["layout", "recent", "desktop-card", "windows"]
let owned_keys : Array[String] = ["layout", "recent", "desktop-card", "windows", "wallpaper"]
///| How state.edn names each wallpaper, in `@libshell.wallpaper_names` order.
let wallpaper_keys : Array[String] = ["plasma-glow", "aurora", "starfield", "dusk", "solid"]
///|
fn read_state_file() -> Array[(@edn.Value, @edn.Value)] {
@@ -62,7 +68,7 @@ fn lookup_key(
///| Read state.edn. Without `persist` nothing is read.
pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
if !self.persist {
return { layout: None, recent: None, desk: None, windows: {} }
return { layout: None, recent: None, desk: None, windows: {}, wallpaper: None }
}
let entries = read_state_file()
let layout = match lookup_key(entries, "layout") {
@@ -135,7 +141,19 @@ pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
}
_ => ()
}
{ layout, recent, desk, windows }
let wallpaper = match lookup_key(entries, "wallpaper") {
Some(Keyword(k)) => {
let mut found : Int? = None
for i = 0; i < wallpaper_keys.length(); i = i + 1 {
if wallpaper_keys[i] == k {
found = Some(i)
}
}
found
}
_ => None
}
{ layout, recent, desk, windows, wallpaper }
}
///| Take the saved recents (the layout is the compositor's to apply).
@@ -143,6 +161,10 @@ pub fn DesktopShell::apply_state(self : DesktopShell, st : SavedState) -> Unit {
for app, g in st.windows {
self.win_geoms.set(app, g)
}
match st.wallpaper {
Some(i) => self.wallpaper_sel = i
None => ()
}
match st.desk {
Some((x, y)) => {
self.desk_set = true
@@ -211,6 +233,9 @@ pub fn DesktopShell::save_state(self : DesktopShell) -> Unit {
(@edn.Value::Keyword("y"), @edn.Value::Integer(y.to_string())),
])))
}
if self.wallpaper_sel > 0 && self.wallpaper_sel < wallpaper_keys.length() {
entries.insert(2, (@edn.Value::Keyword("wallpaper"), @edn.Value::Keyword(wallpaper_keys[self.wallpaper_sel])))
}
let body : String? = try Some(@edn.pretty(@edn.Value::Mapping(entries), layout={ width: 100, indent: 1 })) catch { _ => None }
match body {
Some(b) => {