Settings module: Session, Desktop and Panel tabs; the module manager moves in
CI / test (push) Failing after 15s
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:
20 files changed
+316
-917
No files matched your search
@@ -5,17 +5,18 @@
|
||||
/// A module is a wasm plasmoid component (`chandra:desktop/plasmoid`). Its imports
|
||||
/// are the capabilities it was granted: `theme` and `clock` always, `app-catalog` /
|
||||
/// `app-launch` for the application menu, `windows` for the task list, `layout-control`
|
||||
/// for the layout switcher, `inspector` for the Interface Explorer button and `modules`
|
||||
/// for the module manager. The manager is itself just a module: the wasm picker
|
||||
/// ("Module manager..." in the panel menu) loads it on demand and opens it.
|
||||
/// for the layout switcher, `inspector` for the Interface Explorer button, and
|
||||
/// `session-settings`, `wallpaper` and `modules` for the settings module. Managing modules is a
|
||||
/// tab of that module: the wasm picker ("Modules..." in the panel menu) loads it on demand and
|
||||
/// opens that tab.
|
||||
|
||||
///| Modules loaded into a fresh panel, in order. `tasks` stretches, so what follows it packs right.
|
||||
let default_panel : Array[String] = [
|
||||
"launcher", "inspector", "layout", "tasks", "moon-disc", "clock-digital12", "session-settings", "logout",
|
||||
]
|
||||
|
||||
///| The module whose popup is the wasm picker.
|
||||
let manager_module : String = "module-manager"
|
||||
///| The module whose popup holds the wasm picker (its Modules tab).
|
||||
let manager_module : String = "session-settings"
|
||||
|
||||
///| Directories searched for `*.wasm` modules, highest priority first.
|
||||
fn module_dirs() -> Array[String] {
|
||||
@@ -171,13 +172,14 @@ fn wall_secs() -> Int {
|
||||
@sys.wall_time_field(3) * 3600 + @sys.wall_time_field(4) * 60 + @sys.wall_time_field(5)
|
||||
}
|
||||
|
||||
///| Panels saved before the wallpaper chooser moved into the settings module list "wallpaper":
|
||||
/// the settings module takes its place (once; a panel that already has it just drops it).
|
||||
///| Panels saved before the wallpaper chooser and the module manager moved into the settings
|
||||
/// module list "wallpaper" or "module-manager": the settings module takes the first one's place
|
||||
/// (a panel that already has it just drops them).
|
||||
fn migrate_panel(entries : Array[String]) -> Array[String] {
|
||||
let has_settings = entries.contains("session-settings")
|
||||
let out : Array[String] = []
|
||||
for e in entries {
|
||||
if e == "wallpaper" {
|
||||
if e == "wallpaper" || e == "module-manager" {
|
||||
if !has_settings && !out.contains("session-settings") {
|
||||
out.push("session-settings")
|
||||
}
|
||||
@@ -192,6 +194,7 @@ fn migrate_panel(entries : Array[String]) -> Array[String] {
|
||||
test "a saved panel's wallpaper button becomes the settings module" {
|
||||
assert_eq(migrate_panel(["launcher", "wallpaper", "logout"]), ["launcher", "session-settings", "logout"])
|
||||
assert_eq(migrate_panel(["wallpaper", "session-settings"]), ["session-settings"])
|
||||
assert_eq(migrate_panel(["module-manager", "clock", "wallpaper"]), ["session-settings", "clock"])
|
||||
assert_eq(migrate_panel(["clock"]), ["clock"])
|
||||
}
|
||||
|
||||
@@ -586,9 +589,19 @@ fn DesktopShell::poll_picker(self : DesktopShell) -> Unit {
|
||||
}
|
||||
}
|
||||
|
||||
///| The wasm picker: open the module manager app to choose what to load, loading the
|
||||
/// manager itself first if it is not in the panel.
|
||||
pub fn DesktopShell::open_module_manager(self : DesktopShell) -> Bool {
|
||||
///| Tabs of the settings module's popup, for `open_settings`.
|
||||
pub(all) enum SettingsTab {
|
||||
/// The session switches.
|
||||
Session
|
||||
/// What is on the desktop: the wallpaper (modules can't be placed on the desktop yet).
|
||||
Desktop
|
||||
/// The panel's modules: remove, add, browse.
|
||||
Panel
|
||||
} derive(Eq, Debug)
|
||||
|
||||
///| Open the settings module ("System settings") on `tab`, loading it into the panel first if it
|
||||
/// isn't there. False when it can't be found or loaded.
|
||||
pub fn DesktopShell::open_settings(self : DesktopShell, tab : SettingsTab) -> Bool {
|
||||
self.ensure_booted()
|
||||
let mut mgr : Widget? = None
|
||||
for w in self.widgets {
|
||||
@@ -599,7 +612,7 @@ pub fn DesktopShell::open_module_manager(self : DesktopShell) -> Bool {
|
||||
if mgr is None {
|
||||
match self.find_module(manager_module) {
|
||||
None => {
|
||||
self.say("Module manager not found (build it with scripts/build-modules.sh)")
|
||||
self.say("Settings module not found (build it with scripts/build-modules.sh)")
|
||||
return false
|
||||
}
|
||||
Some(c) => mgr = self.load_path(c.path)
|
||||
@@ -612,12 +625,24 @@ pub fn DesktopShell::open_module_manager(self : DesktopShell) -> Bool {
|
||||
if w.popup_rect.w == 0 {
|
||||
ignore(self.deliver(w, false, PointerDown(0, 0)))
|
||||
}
|
||||
// The module's keys 1, 2, 3 pick its tabs.
|
||||
let key = match tab {
|
||||
Session => "1"
|
||||
Desktop => "2"
|
||||
Panel => "3"
|
||||
}
|
||||
ignore(self.deliver(w, true, KeyDown(key)))
|
||||
self.save_panel_config()
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///| The wasm picker: open the settings module on its Panel tab to choose what to load.
|
||||
pub fn DesktopShell::open_module_manager(self : DesktopShell) -> Bool {
|
||||
self.open_settings(Panel)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- right-click menu
|
||||
|
||||
///| Title row height and item row height of the menu.
|
||||
@@ -658,13 +683,13 @@ pub fn DesktopShell::right_click(self : DesktopShell, x : Int, y : Int) -> Bool
|
||||
}
|
||||
}
|
||||
rows.push({ label: "Remove widget", kind: 1, arg: "" })
|
||||
rows.push({ label: "Module manager...", kind: 2, arg: "" })
|
||||
rows.push({ label: "Modules...", kind: 2, arg: "" })
|
||||
self.open_menu(w.pl.name, rows, w.slot, x)
|
||||
true
|
||||
}
|
||||
None =>
|
||||
if inside(self.panel_rect, x, y) {
|
||||
self.open_menu("Add widget", [{ label: "Module manager...", kind: 2, arg: "" }], "", x)
|
||||
self.open_menu("Add widget", [{ label: "Modules...", kind: 2, arg: "" }], "", x)
|
||||
true
|
||||
} else {
|
||||
was_open
|
||||
|
||||
Reference in new issue
Block a user