CI / test (push) Failing after 45s
- A sixth Settings tab, Apps (key 6, SettingsTab::Apps; the popup is 390 px wide for it): Web
browser, Email, File manager, Terminal, Text editor, Image viewer, Video player, Music player,
PDF and documents, Archive manager. Each row shows the current default with its real icon (the
icon-theme lookup the task manager uses; a letter tile when there is none). Click a row to list
the installed apps that can take it, click one to make it the default. A chosen app that has
been uninstalled since is named in red under its row ("gthumb is not installed any more").
- Installed apps come from the .desktop files in the XDG data dirs (and flatpak's exports), with
MimeType= and Categories= (desktop_entry_keys, now shared with the launcher's parse_desktop).
A kind lists the shown apps that handle one of its MIME types; the terminal lists
TerminalEmulator apps; browsers are only offered as browsers.
- Reading follows the mimeapps.list spec: $XDG_CONFIG_HOME/[chandra-]mimeapps.list, then
$XDG_CONFIG_DIRS (/etc/xdg), then $XDG_DATA_HOME and $XDG_DATA_DIRS applications/; the first
installed [Default Applications] entry wins, else [Added Associations], else mimeinfo.cache
(minus [Removed Associations]), else the first installed app that handles the type. A hidden
(NoDisplay) default still counts and its name is shown.
- Setting writes [Default Applications] in ~/.config/mimeapps.list for each of the kind's MIME
types the app handles (always the main one: http/https/text/html for browsers, mailto,
inode/directory, text/plain, image/png..., video/mp4..., audio/mpeg..., application/pdf...,
application/zip...), as xdg-mime default / xdg-settings do, without running them. Every other
section, entry, comment and blank line is kept; the app leaves those types' [Removed
Associations]; a chandra-mimeapps.list that already names one of those types is updated too.
- The terminal has no MIME type: state.edn :terminal "kitty" (desktop id), also written first in
~/.config/xdg-terminals.list (xdg-terminal-exec). Terminal=true apps from the launcher (and
session restore) now start in it (foot -e, kgx/gnome-terminal/ptyxis --, kitty <cmd>, wezterm
start --) instead of always foot; with no choice: xdg-terminals.list, then foot, then any
installed terminal. Terminal apps are listed when any terminal emulator is installed, not only
foot.
- New `default-apps` capability (categories, apps, set-default, refresh): host tables 11 (sss:
name current missing) and 12 (issii: category id name icon current), request 19 (category *
1000 + app, -1 rescans) in the wasmer/wasmtime stub, host-wasm and the MoonBit wasmhost
(chandra:host/plasmoids default-app(s32)). Nothing is scanned until the tab opens (refresh).
- Tests with a temporary XDG tree: categories and current defaults (user file, system file,
Added Associations, mimeinfo.cache, missing apps, hidden defaults), writing that keeps other
entries, desktop-specific files, the terminal list and commands, the Apps tab end to end, and
the :terminal round trip through state.edn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgywj7RPmFdFhpzGZj
167 lines
6.4 KiB
Plaintext
167 lines
6.4 KiB
Plaintext
package chandra:host@0.1.0;
|
|
|
|
/// Panel modules (plasmoids) for a compositor that is itself a component. A component can't embed
|
|
/// a second wasm runtime, so the host runs the modules (wasmtime) and the compositor drives them
|
|
/// through this interface. It mirrors compositor/wasm: load, draw, events, plus the host data a
|
|
/// module may read and the requests it may make.
|
|
interface plasmoids {
|
|
use chandra:desktop/types@0.1.0.{draw-op, input-event, size};
|
|
use chandra:desktop/theme@0.1.0.{tokens};
|
|
|
|
/// A loaded module. `imports` is its capability grant: the host interfaces its binary imports
|
|
/// (besides theme), e.g. ["clock"] or ["windows", "system"].
|
|
record loaded {
|
|
handle: u32,
|
|
id: string,
|
|
name: string,
|
|
preferred: size,
|
|
min-width: u32,
|
|
stretch: bool,
|
|
imports: list<string>,
|
|
}
|
|
/// Load the plasmoid component at `path`. The error is a short reason.
|
|
load: func(path: string) -> result<loaded, string>;
|
|
unload: func(handle: u32);
|
|
|
|
/// The theme the modules see through `theme.get-tokens` (set before drawing so a swap shows at once).
|
|
set-tokens: func(t: tokens);
|
|
render: func(handle: u32, box: size) -> list<draw-op>;
|
|
|
|
record popup-surface {
|
|
box: size,
|
|
ops: list<draw-op>,
|
|
}
|
|
popup: func(handle: u32) -> option<popup-surface>;
|
|
/// Deliver an event to the module (`on-popup`: to its popup surface). True when it wants a redraw.
|
|
on-event: func(handle: u32, on-popup: bool, event: input-event) -> bool;
|
|
|
|
/// One of a module's own settings (chandra:desktop/module-config `config-item`): `choices`
|
|
/// empty means an on/off switch whose value is "on" or "off".
|
|
record config-item {
|
|
key: string,
|
|
label: string,
|
|
choices: list<string>,
|
|
value: string,
|
|
}
|
|
/// The module's settings for its right-click menu; empty when it doesn't export module-config.
|
|
config-items: func(handle: u32) -> list<config-item>;
|
|
/// Set one of them. True when the module wants a redraw (false without module-config).
|
|
set-config: func(handle: u32, key: string, value: string) -> bool;
|
|
|
|
// ---- host data modules read through their capabilities ----
|
|
|
|
/// Row tables, as built by compositor/wasm: a LE u32 row count, then per row each field as a LE
|
|
/// i32 ('i') or a LE u32 byte length + UTF-8 ('s'). `which`: 0 apps (sssss: id name comment
|
|
/// category glyph), 1 windows (isii: id title focused minimized), 2 layouts (s), 3 modules
|
|
/// (sssi: id name path loaded), 4 instances (sss: slot module name), 5 wallpapers (s), 6 session
|
|
/// settings (s), 7 icons (si: app id, raster image handle from `raster.load-image`) served by `icons.app-icon`,
|
|
/// 8 network status (one row, iissiiii: state signal name message wifi-enabled airplane
|
|
/// can-manage has-wifi), 9 Wi-Fi networks (siiii: ssid signal secured active saved), 10 keyboard
|
|
/// shortcuts (ssssi: name binding default-binding conflict capturing), 11 default-app
|
|
/// categories (sss: name current missing), 12 default-app choices (issii: category id name icon current).
|
|
publish-table: func(which: u32, rows: list<u8>);
|
|
/// Layout mode (0 tiling, 1 monocle, 2 floating) and whether the Interface Explorer is on.
|
|
publish-state: func(layout-mode: s32, inspector-on: bool);
|
|
/// The wallpaper on the desktop now (an index into the wallpapers table).
|
|
publish-wallpaper: func(current: s32);
|
|
/// Which session settings are on: bit i for row i of the session settings table.
|
|
publish-session-settings: func(on: u32);
|
|
/// The power timeouts, in minutes (0: never).
|
|
publish-power: func(screen-off: u32, suspend: u32);
|
|
/// The battery: percent (-1: none), state (the battery capability's charge-state, as its index)
|
|
/// and estimated seconds left (0: unknown).
|
|
publish-battery: func(percent: s32, state: u32, secs-left: u32);
|
|
/// Screenshot state: bit 0 a recording is running, bit 1 recordings show the pointer.
|
|
publish-screenshot: func(state: u32);
|
|
|
|
record system-snapshot {
|
|
cpu-permille: u32,
|
|
mem-used-kib: u64,
|
|
mem-total-kib: u64,
|
|
battery-percent: s32,
|
|
charging: bool,
|
|
uptime-secs: u64,
|
|
net-rx-bytes-per-sec: u64,
|
|
net-tx-bytes-per-sec: u64,
|
|
load-centi: u32,
|
|
}
|
|
publish-system: func(s: system-snapshot);
|
|
|
|
record window-entry {
|
|
id: u64,
|
|
title: string,
|
|
app-id: string,
|
|
focused: bool,
|
|
}
|
|
publish-windows: func(wins: list<window-entry>);
|
|
|
|
/// A network module's action: 0 scan, 1 disconnect, 2/3 Wi-Fi off/on, 4/5 airplane mode
|
|
/// off/on, 6 connect (ssid, password), 7 forget (ssid).
|
|
record network-request {
|
|
action: s32,
|
|
ssid: string,
|
|
password: string,
|
|
}
|
|
|
|
/// A module moving a panel instance `delta` places (negative: towards the start).
|
|
record instance-move {
|
|
slot: string,
|
|
delta: s32,
|
|
}
|
|
|
|
/// A module turning a session setting on or off.
|
|
record setting-change {
|
|
index: s32,
|
|
on: bool,
|
|
}
|
|
|
|
// ---- what modules asked of the host ----
|
|
|
|
variant request {
|
|
launch(string),
|
|
focus-window(s32),
|
|
set-layout(s32),
|
|
set-inspector(bool),
|
|
load-module(string),
|
|
unload-instance(string),
|
|
browse,
|
|
logout,
|
|
set-wallpaper(s32),
|
|
set-session-setting(setting-change),
|
|
/// The screenshot capability: 0-3 take(mode), 10-12 start-recording(mode), 20 stop recording,
|
|
/// 30/31 hide/show the pointer in recordings.
|
|
screenshot(s32),
|
|
/// Power: new screen-off / suspend timeouts in minutes; an action now (0 suspend, 1 power
|
|
/// off, 2 restart).
|
|
set-screen-off(s32),
|
|
set-suspend-after(s32),
|
|
power-action(s32),
|
|
network(network-request),
|
|
move-instance(instance-move),
|
|
/// The shortcuts capability: action * 1000 + index (0 capture, 1 reset, 2 reset all,
|
|
/// 3 cancel the capture).
|
|
shortcut(s32),
|
|
/// The session capability's `reload`: reload every loaded panel module from disk.
|
|
reload-session,
|
|
/// The default-apps capability: category * 1000 + app (set that category's default to its
|
|
/// app-th app), or -1 to scan the apps and defaults again.
|
|
default-app(s32),
|
|
}
|
|
/// The next pending request, oldest first.
|
|
next-request: func() -> option<request>;
|
|
/// A window a module asked to focus through `windows.focus` (64-bit id), since the last call.
|
|
take-focus-request: func() -> option<u64>;
|
|
|
|
/// Names of the `*.wasm` files directly in `dir`, sorted.
|
|
list-wasm-files: func(dir: string) -> list<string>;
|
|
|
|
/// A native file-chooser dialog (zenity on the host session) for "Add widget".
|
|
variant picker-state {
|
|
open,
|
|
cancelled,
|
|
chosen(string),
|
|
}
|
|
picker-start: func() -> bool;
|
|
picker-poll: func() -> picker-state;
|
|
}
|