Settings > Panel: a cleaner module selector with reordering
CI / test (push) Failing after 17s

The Panel tab was one flat list: every panel module with an "x" that removed
it on any click, then every module on disk again with cryptic "x1" counts and
a Browse row that looked selected.

- "In the panel, left to right": the modules in panel order, each with
  move up / move down / remove buttons. Clicking the row itself does nothing,
  so a stray click no longer removes a module. Backspace/Delete removes the
  highlighted one, PageUp/PageDown move it.
- "Add to the panel": grouped (Apps and windows, System, Clocks, Other),
  each with a one-line description and an Add button. A module already in the
  panel is left out, except clocks, which offer "Add another". With nothing
  left: "Everything is in the panel".
- "Browse for a module file..." is a secondary outlined button.
- Section headings are larger and full contrast; the popup is 320 wide and
  now fits a 720-high screen with the default panel.

Reordering goes through a new modules.move-instance(slot, delta) capability
call, plumbed through both hosts: wasmer stub request 17, host-wasm, the
plasmoids host WIT (move-instance(instance-move)) and wasmhost. The shell's
move_slot clamps to the ends and saves panel.edn, so the saved format is
unchanged. DesktopShell::slot_popup_texts lets tests find popup rows by text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhRDWZf5WcmrNwnFe3
This commit is contained in:
Claude committed 2026-11-25 20:35:54 +00:00
1 parent c1936299cb
commit 8ecdef17d4
16 files changed
+514 -98

No files matched your search

+46
View File
@@ -359,6 +359,34 @@ pub fn DesktopShell::unload_slot(self : DesktopShell, slot : String) -> Bool {
}
}
///| Move the module in `slot` `delta` places along the panel (clamped to either end) and save
/// the new order. False when there is no such slot or it is already at that end.
pub fn DesktopShell::move_slot(self : DesktopShell, slot : String, delta : Int) -> Bool {
let mut idx = -1
for i = 0; i < self.widgets.length(); i = i + 1 {
if self.widgets[i].slot == slot {
idx = i
}
}
if idx < 0 {
return false
}
let mut to = idx + delta
if to < 0 {
to = 0
}
if to > self.widgets.length() - 1 {
to = self.widgets.length() - 1
}
if to == idx {
return false
}
let w = self.widgets.remove(idx)
self.widgets.insert(to, w)
self.save_panel_config()
true
}
///| Replace the module in `slot` with the module file at `path`, keeping its place in the panel.
pub fn DesktopShell::replace_slot(self : DesktopShell, slot : String, path : String) -> Bool {
let mut idx = -1
@@ -438,6 +466,23 @@ pub fn DesktopShell::slot_popup_rect(self : DesktopShell, slot : String) -> @sce
}
}
///| The text drawn in `slot`'s open popup, with each line's popup-local origin, in drawing
/// order (empty when the popup is closed). Lets tests find a row without knowing the layout.
pub fn DesktopShell::slot_popup_texts(self : DesktopShell, slot : String) -> Array[(String, Int, Int)] {
let out = []
match self.widget_by_slot(slot) {
Some(w) =>
for op in w.popup_ops {
match op {
Text(t) => out.push((t.text, t.origin.x, t.origin.y))
_ => ()
}
}
None => ()
}
out
}
///| Publish what modules can read through their capabilities (apps, windows, layout, loaded modules).
fn DesktopShell::publish_host_data(self : DesktopShell) -> Unit {
if self.apps_dirty {
@@ -624,6 +669,7 @@ fn DesktopShell::process_requests(self : DesktopShell) -> Unit {
}
}
Some(UnloadInstance(slot)) => ignore(self.unload_slot(slot))
Some(MoveInstance(slot, delta)) => ignore(self.move_slot(slot, delta))
Some(Browse) =>
if self.picker is None {
self.picker = @wasm.Picker::start()