CI / test (push) Failing after 52s
- Lock the session from the power button or `chandra-ctl lock` - Unlock with a face or the password; the password always works - Add compositor lock module with tests, and a polkit unlock policy (org.chandra.unlock) - Document the lock flow in docs/lock.md and link it from the README - Add generated interface bindings for the compositor and widget components
453 lines
17 KiB
Plaintext
453 lines
17 KiB
Plaintext
package chandra: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);
|
|
|
|
}
|
|
|
|
/// App icons. The host finds the app's .desktop file (by desktop id or StartupWMClass), reads its
|
|
/// Icon= key and looks it up in the freedesktop icon themes; the widget only gets a handle to draw
|
|
/// with a `draw-op.image`, never a path or pixels.
|
|
interface icons {
|
|
/// The icon of the app whose windows carry `app-id`, or 0 when the host has none (draw your
|
|
/// own stand-in then).
|
|
app-icon: func(app-id: string) -> u32;
|
|
}
|
|
|
|
/// 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);
|
|
/// Move one loaded instance `delta` places along the panel (negative: towards the start).
|
|
move-instance: func(slot: string, delta: s32);
|
|
/// Ask the host to show its native file chooser for a .wasm elsewhere on disk.
|
|
browse: func();
|
|
}
|
|
|
|
/// The login session. `logout` ends it: the host stops the compositor, and the display manager
|
|
/// takes the screen back. `reload` reloads it in place: every loaded panel module is read from
|
|
/// disk again (same order, same module settings) and the module list is rescanned; windows and
|
|
/// running apps are untouched. The Application Launcher's session row uses both.
|
|
interface session {
|
|
logout: func();
|
|
reload: func();
|
|
}
|
|
|
|
/// The desktop wallpaper. The shell draws a fixed set of wallpapers (from draw ops, coloured by the
|
|
/// theme); a module with this capability (the settings module) lists them and picks which one is on
|
|
/// the desktop.
|
|
interface wallpaper {
|
|
/// Display names, indexed by choice.
|
|
wallpapers: func() -> list<string>;
|
|
current-wallpaper: func() -> u32;
|
|
/// Show wallpaper `index` (out-of-range indices are ignored). The choice is remembered.
|
|
set-wallpaper: func(index: u32);
|
|
/// What fills the desktop, as display names indexed by choice: 0 "Wallpaper only", 1 "Clock
|
|
/// card" (the built-in card), then every installed desktop module (docs/desktop-modules.md).
|
|
desktops: func() -> list<string>;
|
|
current-desktop: func() -> u32;
|
|
/// Put desktop `index` on the desktop (out-of-range indices are ignored). The choice is
|
|
/// remembered (state.edn `:desktop`).
|
|
set-desktop: func(index: u32);
|
|
}
|
|
|
|
/// Session settings: how the login session starts, what it remembers and how it looks (dark or
|
|
/// light). The shell keeps them in state.edn; a module with this capability lists them as on/off
|
|
/// switches and flips them.
|
|
interface session-settings {
|
|
/// Display names, indexed by setting.
|
|
settings: func() -> list<string>;
|
|
/// Whether setting `index` is on (false for an out-of-range index).
|
|
is-on: func(index: u32) -> bool;
|
|
/// Turn setting `index` on or off (out-of-range indices are ignored). The choice is remembered.
|
|
set-setting: func(index: u32, on: bool);
|
|
}
|
|
|
|
/// Keyboard shortcuts: the compositor's named actions (open the launcher, show the desktop, switch
|
|
/// windows, screenshots, recordings) and the key combo each is bound to. The shell keeps changed
|
|
/// combos in state.edn and they apply at once; a module with this capability (the settings
|
|
/// module's Shortcuts tab) lists and rebinds them.
|
|
interface shortcuts {
|
|
record shortcut {
|
|
/// What it does ("Show the desktop").
|
|
name: string,
|
|
/// Its combo as text, modifiers first ("Super+Shift+S"; "Super" alone is a tap of the Super
|
|
/// key); empty when unbound.
|
|
binding: string,
|
|
/// The combo it has by default.
|
|
default-binding: string,
|
|
/// The name of another shortcut on the same combo, or empty. The one listed first wins.
|
|
conflict: string,
|
|
/// Waiting for its new combo (see `capture`).
|
|
capturing: bool,
|
|
}
|
|
/// Every shortcut, in the order they are listed.
|
|
shortcuts: func() -> list<shortcut>;
|
|
/// Bind shortcut `index` to the next key combo pressed anywhere: the compositor takes that key
|
|
/// instead of acting on it. Escape cancels, Backspace unbinds. Window switching needs a combo
|
|
/// with a modifier (it keeps waiting otherwise).
|
|
capture: func(index: u32);
|
|
/// Stop waiting for a combo; the binding stays as it was.
|
|
cancel-capture: func();
|
|
/// Put shortcut `index` back to its default combo.
|
|
reset: func(index: u32);
|
|
reset-all: func();
|
|
}
|
|
|
|
/// Default applications: which installed app opens web links, mail, folders, text, images, video,
|
|
/// music, documents and archives, kept in the freedesktop mimeapps.list that other apps and
|
|
/// xdg-open follow, and which terminal Chandra runs terminal apps in (state.edn, exported as
|
|
/// xdg-terminals.list). A module with this capability (the settings module's Apps tab) lists the
|
|
/// choices and sets them.
|
|
interface default-apps {
|
|
record app-category {
|
|
/// What it is for ("Web browser").
|
|
name: string,
|
|
/// The name of its current default, also when that app is not one of the choices (hidden
|
|
/// from menus); empty when there is none.
|
|
current: string,
|
|
/// The app chosen for it that is no longer installed (its name, or its desktop file id when
|
|
/// that is all that is known), or empty.
|
|
missing: string,
|
|
}
|
|
record app-choice {
|
|
/// Index into `categories`.
|
|
category: u32,
|
|
/// Desktop file id without ".desktop" ("firefox").
|
|
id: string,
|
|
name: string,
|
|
/// Image handle of its icon (0: none; draw your own stand-in then).
|
|
icon: u32,
|
|
/// Whether it is the category's default now.
|
|
current: bool,
|
|
}
|
|
/// The categories, in the order they are shown.
|
|
categories: func() -> list<app-category>;
|
|
/// The installed apps that can be each category's default, grouped by category in category
|
|
/// order, each group in name order.
|
|
apps: func() -> list<app-choice>;
|
|
/// Make the category's `app`-th app (counting within the category, from 0) its default.
|
|
set-default: func(category: u32, app: u32);
|
|
/// Scan the installed apps and the defaults again (another program may have changed them).
|
|
refresh: func();
|
|
}
|
|
|
|
/// Screenshots and screen recordings, after KDE Spectacle. The compositor captures (it alone sees
|
|
/// the screen); a module with this capability offers the modes and starts them.
|
|
interface screenshot {
|
|
/// Take a screenshot: 0 rectangular region (drawn on the selection overlay), 1 full screen,
|
|
/// 2 active window, 3 window under cursor (clicked on the overlay). It is saved to
|
|
/// ~/Pictures/Screenshots and put on the clipboard. Other values are ignored.
|
|
take: func(mode: u32);
|
|
/// Record the screen to ~/Videos/Screencasts: 0 a region (picked on the overlay), 1 the full
|
|
/// screen, 2 a window (clicked on the overlay). While a recording runs this stops it instead.
|
|
start-recording: func(mode: u32);
|
|
/// Stop the recording, if one is running.
|
|
stop-recording: func();
|
|
/// Whether a recording is running.
|
|
is-recording: func() -> bool;
|
|
/// Whether recordings show the pointer, and switching that.
|
|
records-pointer: func() -> bool;
|
|
set-records-pointer: func(on: bool);
|
|
}
|
|
|
|
/// Power: when the login session turns the screen off and suspends after no input, and suspend,
|
|
/// restart or power off now (through logind). A module with this capability is the settings
|
|
/// module's Power tab. The shell keeps the timeouts in state.edn.
|
|
interface power {
|
|
/// Minutes without input before the screen turns off; 0: never.
|
|
screen-off-minutes: func() -> u32;
|
|
set-screen-off-minutes: func(minutes: u32);
|
|
/// Minutes without input before the computer suspends; 0: never.
|
|
suspend-minutes: func() -> u32;
|
|
set-suspend-minutes: func(minutes: u32);
|
|
/// Current display backlight brightness in 0..100, or -1 if no backlight exists.
|
|
brightness: func() -> s32;
|
|
/// Set display backlight brightness percentage (clamped to 5..100).
|
|
set-brightness: func(percent: u32);
|
|
/// Suspend, power off or restart now.
|
|
suspend: func();
|
|
power-off: func();
|
|
reboot: func();
|
|
}
|
|
|
|
/// The battery, as the battery panel module shows it. The host samples it about once a second
|
|
/// (on Linux from /sys/class/power_supply, every battery together); the module never reads it
|
|
/// itself.
|
|
interface battery {
|
|
enum charge-state {
|
|
/// No battery: a desktop on mains power.
|
|
none,
|
|
discharging,
|
|
charging,
|
|
full,
|
|
/// On mains power but not charging (a charge limit, or the battery is too warm).
|
|
not-charging,
|
|
}
|
|
record status {
|
|
/// 0..100, or -1 without a battery.
|
|
percent: s32,
|
|
state: charge-state,
|
|
/// Estimated seconds until empty while discharging, until full while charging; 0 unknown.
|
|
secs-left: u32,
|
|
}
|
|
read: func() -> status;
|
|
}
|
|
|
|
/// Network status and control (NetworkManager), for the network panel module. The shell talks to
|
|
/// NetworkManager over D-Bus; without it, status comes read-only from /sys/class/net and
|
|
/// /proc/net, `can-manage` is false and the actions do nothing.
|
|
interface network {
|
|
record net-status {
|
|
/// 0 offline, 1 wired, 2 Wi-Fi, 3 connecting.
|
|
state: u32,
|
|
/// Signal of the Wi-Fi network in use, 0..100 (0 when not on Wi-Fi).
|
|
signal: u32,
|
|
/// The Wi-Fi network's name, else the connection's (e.g. "Wired connection 1"); "" offline.
|
|
name: string,
|
|
/// An action's outcome or why it failed, to show ("" for nothing).
|
|
message: string,
|
|
wifi-enabled: bool,
|
|
/// Wi-Fi and mobile broadband both off.
|
|
airplane: bool,
|
|
/// The network can be changed from here (NetworkManager answers).
|
|
can-manage: bool,
|
|
/// There is a Wi-Fi device.
|
|
has-wifi: bool,
|
|
}
|
|
record wifi-network {
|
|
ssid: string,
|
|
/// 0..100.
|
|
signal: u32,
|
|
secured: bool,
|
|
/// The one in use.
|
|
active: bool,
|
|
/// There is a saved connection for it: connecting needs no password.
|
|
saved: bool,
|
|
}
|
|
status: func() -> net-status;
|
|
/// Wi-Fi networks in range, the one in use first, then by signal (empty with Wi-Fi off).
|
|
wifi-networks: func() -> list<wifi-network>;
|
|
/// Ask the Wi-Fi device to look for networks (the list fills in over a few seconds).
|
|
scan: func();
|
|
/// Connect to `ssid`: a saved network as saved, a new one with `password` ("" when open).
|
|
/// WPA/WPA2/WPA3 personal and open networks; the outcome shows in `status.message`.
|
|
connect: func(ssid: string, password: string);
|
|
/// Disconnect the Wi-Fi device.
|
|
disconnect: func();
|
|
/// Delete the saved connection(s) for `ssid`.
|
|
forget: func(ssid: string);
|
|
set-wifi-enabled: func(on: bool);
|
|
set-airplane-mode: func(on: bool);
|
|
}
|
|
|
|
/// Face unlock (docs/face-unlock.md): the session user's enrolled faces and whether the password
|
|
/// dialog and sudo try the face first. Faces are added and removed in the compositor's Face unlock
|
|
/// window, whose Apply runs chandra-face through run0 or pkexec once, so polkit asks for an
|
|
/// administrator's password before anything changes; the module never sees a camera picture or
|
|
/// any face data, only labels.
|
|
interface face-unlock {
|
|
record face-status {
|
|
/// Why face unlock can't work yet ("python3-opencv is not installed"), or empty.
|
|
problem: string,
|
|
/// PAM services that use Howdy's pam_howdy.so, comma-separated, or empty.
|
|
howdy: string,
|
|
/// What the running change said last ("Look at the camera… 3/5"), or how the last one
|
|
/// ended; empty when none ran.
|
|
message: string,
|
|
/// chandra-face is installed (`just install`).
|
|
installed: bool,
|
|
/// The password dialog (PAM service polkit-1) and sudo try the face first.
|
|
in-use: bool,
|
|
/// A change (enroll, remove, set-in-use) is running.
|
|
busy: bool,
|
|
}
|
|
record face {
|
|
label: string,
|
|
/// When it was enrolled (YYYY-MM-DD).
|
|
added: string,
|
|
}
|
|
status: func() -> face-status;
|
|
/// The enrolled faces, oldest first.
|
|
faces: func() -> list<face>;
|
|
/// Open the Face unlock window (live camera picture, Snap, saved faces, one Apply).
|
|
enroll: func();
|
|
/// Open the Face unlock window with face `index` of `faces` marked for removal.
|
|
remove: func(index: u32);
|
|
/// Try the face first in the password dialog and sudo, or stop.
|
|
set-in-use: func(on: bool);
|
|
/// Read the status and the faces again.
|
|
refresh: func();
|
|
}
|
|
|
|
/// A game library (docs/gamerig-library.md): the games and apps a game-streaming rig offers, what
|
|
/// runs, and the rig's GPU, display and audio. The host gets all of it from gamerig's library
|
|
/// daemon (`GET /api/state` on 127.0.0.1:8091, or GAMERIG_DESKTOP_API), polled every couple of
|
|
/// seconds; the module never talks to the network itself. Launch, stop and focus go back to the
|
|
/// daemon, which starts games on the rig's X server.
|
|
interface game-library {
|
|
record rig-status {
|
|
/// Why the daemon can't be reached ("Library daemon not reachable"), or what the last action
|
|
/// said went wrong; empty when all is well.
|
|
error: string,
|
|
gpu: string,
|
|
resolution: string,
|
|
display: string,
|
|
audio: string,
|
|
hostname: string,
|
|
/// The daemon answered the last poll.
|
|
connected: bool,
|
|
audio-ok: bool,
|
|
}
|
|
record game {
|
|
id: string,
|
|
name: string,
|
|
/// games, launchers or tools.
|
|
category: string,
|
|
description: string,
|
|
/// An icon name from gamerig's catalog (Play, Sparkles, Folder, Star, Box, Terminal,
|
|
/// Settings, ExternalLink ...).
|
|
icon: string,
|
|
/// What to do when it can't start (not installed).
|
|
install-hint: string,
|
|
featured: bool,
|
|
installed: bool,
|
|
running: bool,
|
|
}
|
|
/// A way to start a game other than plain Launch (Steam's Big Picture).
|
|
record launch-mode {
|
|
game: string,
|
|
id: string,
|
|
label: string,
|
|
}
|
|
status: func() -> rig-status;
|
|
/// In catalog order.
|
|
games: func() -> list<game>;
|
|
launch-modes: func() -> list<launch-mode>;
|
|
/// Start `game` (`mode` "default", or one of its launch modes).
|
|
launch: func(game: string, mode: string);
|
|
/// Stop it (SIGTERM, then SIGKILL).
|
|
stop: func(game: string);
|
|
/// Raise its window over the desktop.
|
|
focus: func(game: string);
|
|
/// Poll the daemon again now.
|
|
refresh: func();
|
|
}
|
|
|
|
/// Built-in on-screen keyboard (OSK). The compositor draws the keyboard above the panel and routes
|
|
/// keystrokes to focused Wayland clients, panel popups and dialogs; a module with this capability
|
|
/// reads whether the keyboard is showing and opens or hides it.
|
|
interface osk {
|
|
/// Whether the on-screen keyboard is currently visible.
|
|
is-visible: func() -> bool;
|
|
/// Show (true) or hide (false) the on-screen keyboard.
|
|
set-visible: func(visible: bool);
|
|
}
|
|
|
|
/// Display orientation (0°, 90° CW, 180°, 270° CW). The host rotates scanout and input
|
|
/// coordinates; a module with this capability reads the current orientation and rotates it.
|
|
interface rotation {
|
|
/// Current orientation: 0 = 0°, 1 = 90° CW, 2 = 180°, 3 = 270° CW.
|
|
current: func() -> u32;
|
|
/// Set the orientation (0..3, wrapped modulo 4).
|
|
set-rotation: func(rot: u32);
|
|
}
|