CI / test (push) Failing after 28s
- New 'session' capability (wit/capabilities.wit) and 'logout' panel module: a button whose popup asks 'Log out | Cancel' (Enter confirms, Escape cancels). Confirming makes the compositor exit, which ends the login session; works in the wasm host and the native build. In the default panel. - session/install.py --link (just install-session-dev): symlink the host, component, modules, fonts and config into this checkout, so after one root install a rebuild is just 'just compositor-wasm host-wasm modules' for the next login. Plain installs still copy. - Tests: host runtime test for the module, native end-to-end test (click, cancel, confirm). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
120 lines
3.5 KiB
Plaintext
120 lines
3.5 KiB
Plaintext
package moonplasma:desktop@0.1.0;
|
|
|
|
/// Host-brokered capabilities. A component can only call what its world
|
|
/// imports AND what the host grants it in the desktop manifest.
|
|
|
|
interface clock {
|
|
use types.{datetime};
|
|
/// Local wall-clock time (the host owns the time zone).
|
|
now: func() -> datetime;
|
|
}
|
|
|
|
interface app-catalog {
|
|
use types.{app-entry};
|
|
/// Installed applications (static list in the PoC; .desktop files later).
|
|
list-apps: func() -> list<app-entry>;
|
|
}
|
|
|
|
interface app-launch {
|
|
/// Ask the host to start an application by catalog id.
|
|
launch: func(id: string) -> result<_, string>;
|
|
}
|
|
|
|
/// Live machine state, sampled by the host about once a second. The widget never
|
|
/// opens /proc or /sys itself: it can only see what this interface hands it, and
|
|
/// the host can serve it from anything (Linux /proc, a mock, a remote machine).
|
|
interface system {
|
|
record snapshot {
|
|
/// Busy CPU time since the previous sample, 0..1000.
|
|
cpu-permille: u32,
|
|
mem-used-kib: u64,
|
|
mem-total-kib: u64,
|
|
/// 0..100, or -1 when the machine has no battery.
|
|
battery-percent: s32,
|
|
charging: bool,
|
|
uptime-secs: u64,
|
|
net-rx-bytes-per-sec: u64,
|
|
net-tx-bytes-per-sec: u64,
|
|
/// 1-minute load average x 100.
|
|
load-centi: u32,
|
|
}
|
|
read: func() -> snapshot;
|
|
}
|
|
|
|
|
|
/// The window list, as shown by a task bar. `id` is an opaque host handle.
|
|
interface windows {
|
|
record window-info {
|
|
id: u32,
|
|
title: string,
|
|
/// 1 when the window has keyboard focus.
|
|
focused: u32,
|
|
/// 1 when the window is minimized (it stays listed so it can be restored).
|
|
minimized: u32,
|
|
}
|
|
list-windows: func() -> list<window-info>;
|
|
/// Focus, raise (and un-minimize) a window.
|
|
focus-window: func(id: u32);
|
|
|
|
/// Richer, id-stable view for widgets that show more than a task bar (the Pulse widget).
|
|
record window-detail {
|
|
id: u64,
|
|
title: string,
|
|
app-id: string,
|
|
focused: bool,
|
|
}
|
|
all: func() -> list<window-detail>;
|
|
/// Raise and focus a window (restoring it if minimized).
|
|
focus: func(id: u64);
|
|
|
|
}
|
|
|
|
/// The window manager's layout mode (tiling / monocle / floating).
|
|
interface layout-control {
|
|
/// Display names, indexed by mode.
|
|
layout-modes: func() -> list<string>;
|
|
current-layout: func() -> u32;
|
|
set-layout: func(mode: u32);
|
|
}
|
|
|
|
/// The Interface Explorer: hover any system component to see its WIT.
|
|
interface inspector {
|
|
is-on: func() -> bool;
|
|
set-on: func(on: bool);
|
|
}
|
|
|
|
/// Hot-swap of the system's own wasm modules. A module with this capability
|
|
/// is a module manager: it decides what is loaded into the panel.
|
|
interface modules {
|
|
/// A loadable module found on the module search path.
|
|
record module-info {
|
|
/// File stem, e.g. "clock-digital".
|
|
id: string,
|
|
name: string,
|
|
path: string,
|
|
/// How many instances are loaded in the panel right now.
|
|
loaded: u32,
|
|
}
|
|
/// A module instance currently loaded in the panel, in panel order.
|
|
record instance-info {
|
|
slot: string,
|
|
module: string,
|
|
name: string,
|
|
}
|
|
available: func() -> list<module-info>;
|
|
loaded: func() -> list<instance-info>;
|
|
/// Load the module file at `path` into the panel (any number of instances).
|
|
load-module: func(path: string);
|
|
/// Unload one loaded instance, freeing its panel space.
|
|
unload-instance: func(slot: string);
|
|
/// Ask the host to show its native file chooser for a .wasm elsewhere on disk.
|
|
browse: func();
|
|
}
|
|
|
|
/// Ending the login session. A module with this capability is a logout button: the host stops the
|
|
/// compositor, and the display manager takes the screen back.
|
|
interface session {
|
|
logout: func();
|
|
}
|
|
|