Files
chandra/wit/worlds.wit
T
Claude 932fca627e
CI / test (push) Successful in 2m6s
Face unlock: a Howdy-style PAM module, shown in the password dialog and set up in Settings
- face/pam_chandra_face.so (`-auth sufficient`): runs `chandra-face compare` as root with a clean
  environment, forwards what it says as PAM_TEXT_INFO / PAM_ERROR_MSG, and maps its exit status
  to success / auth error / unavailable, so the password always still works. Skips remote
  sessions (PAM_RHOST, SSH_CONNECTION), a closed lid and users without faces; refuses a helper
  that isn't root's; kills one that hangs (timeout + 6 s).
- face/chandra-face (Python + OpenCV): YuNet finds the face, SFace embeds it, cosine similarity
  against the enrolled embeddings (threshold 0.42, two matching frames, dark IR warm-up frames
  skipped, optional require_ir). enroll / list / remove / clear / test / status / pam
  enable|disable / fetch-models (sha256-pinned opencv_zoo models). Embeddings only, in
  /var/lib/chandra-face/USER/faces.json (root, 0600); labels in faces.list (0644). Store, config
  and models must be root's and not writable by others. Root commands re-run through run0 (or
  pkexec), so polkit asks first. Settings in /etc/chandra/face.conf.
- `just install-face [--pam]`, `just uninstall-face [--purge]` (face/install.py; uninstall takes
  the module out of every PAM service first). `pam enable` inserts before the first auth or
  @include line (Debian's sudo has only @include common-auth), keeping a .bak.
- Password dialog: a face row ("Looking for your face…" with a sweeping ring, "Face
  recognized", or why not, "Type your password instead"); typing and Enter during the scan go in
  when PAM asks for the password. Howdy's pam_howdy.so messages are understood too.
- Settings > Session > Face unlock: "Use my face for passwords" (polkit-1 + sudo), the enrolled
  faces (Remove takes a second click), "Add a face…", and the tool's progress. New `face-unlock`
  capability: tables 24 (status) and 25 (faces), request 44, in the wasmer/wasmtime stub, the Rust
  host, the MoonBit wasmhost and chandra:host/plasmoids. compositor/shell/face.mbt runs the tool
  on a socket so the compositor never waits.
- Tests: face/test_face.py (fake camera of PGM frames + fake recognizer; --pam builds the module
  and runs it through pamtester), dialog states and message parsing (polkit_test), the dialog via
  a mock helper (auth_test, shots 14/15), Settings against a fake chandra-face (face_test).
  scripts/test.sh runs them (compositor/polkit was missing from its native list), CI installs
  libpam0g-dev + pamtester. Also regenerated two stale desktop-module bindings (doc comments).
- docs/face-unlock.md, including the limits of 2D face recognition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
2026-11-26 01:19:29 +00:00

170 lines
4.7 KiB
Plaintext

package chandra:desktop@0.1.0;
/// Minimum every widget gets: theme tokens. Everything else is opt-in.
world widget {
import theme;
export plasmoid;
}
world clock-widget {
include widget;
import clock;
export module-config;
}
/// The optional `module-config` export on its own. A module of any world may add it to get its own
/// settings in its right-click menu; hosts look it up separately (host-wasm binds it with this world).
world configurable {
export module-config;
}
/// The optional `desktop-module` export on its own (wit/desktop.wit): what makes a module a
/// desktop module. Hosts look it up by name like `module-config` (host-wasm binds this world).
world desktop-export {
export desktop-module;
}
/// The application launcher. The launcher's popup
/// also ends in a session row: Reload, Log out, Suspend, Restart, Power off.
world launcher-widget {
include widget;
import app-catalog;
import app-launch;
import session;
import power;
}
/// The dock: pinned apps plus running ones, with their theme icons, a dot per open window, a click
/// that starts the app or brings its windows forward, and right-click settings (icon size,
/// magnification, running apps). The shell keeps the pinned list (hidden `pinned` setting) and
/// draws the per-app right-click menu (Pin, Move, Quit), sharing lib/dock's layout.
world dock-widget {
include widget;
import app-catalog;
import app-launch;
import windows;
import icons;
export module-config;
}
world panel {
import theme;
export panel-layout;
}
/// Reference shell: panel + desktop background in one component.
world shell {
import theme;
export desktop-surface;
export panel-layout;
}
/// Desktop Pulse: reads machine state and the window list, and can raise a window.
world pulse-widget {
include widget;
import system;
import windows;
}
/// Layout switcher.
world layout-widget {
include widget;
import layout-control;
}
/// Interface Explorer toggle.
world inspector-widget {
include widget;
import inspector;
}
/// Everything a panel module can be granted. The native host instantiates any module against this
/// one world (a module simply imports the subset it uses) and serves each import from the data the
/// compositor publishes (wit/host/plasmoids.wit).
world plasmoid-host {
import theme;
import clock;
import app-catalog;
import app-launch;
import windows;
import layout-control;
import inspector;
import modules;
import system;
import session;
import wallpaper;
import session-settings;
import icons;
import screenshot;
import power;
import battery;
import network;
import shortcuts;
import default-apps;
import face-unlock;
export plasmoid;
}
/// The settings module: session switches (restore, window places, dark mode), the wallpaper, the
/// panel's modules (load, unload, browse; the panel menu's "Modules..." opens that tab), and power
/// (idle timeouts, battery, suspend / restart / power off), keyboard shortcuts (rebind, reset),
/// default apps (browser, email, files, terminal, editor, viewers and players) and face unlock.
world session-settings-widget {
include widget;
import session-settings;
import wallpaper;
import modules;
import power;
import system;
import shortcuts;
import default-apps;
import face-unlock;
}
/// Screenshot and screen recording launcher.
world screenshot-widget {
include widget;
import screenshot;
}
/// Battery charge, charging state and time left in the panel; its right-click settings choose what
/// shows.
world battery-widget {
include widget;
import battery;
export module-config;
}
/// Network status (Ethernet, Wi-Fi name and signal, offline) and a popup to pick a Wi-Fi network,
/// connect, disconnect, and switch Wi-Fi or airplane mode.
world network-widget {
include widget;
import network;
}
/// A desktop module (wit/desktop.wit): a plasmoid drawn full screen behind the windows. The
/// minimum: theme tokens in, draw ops and input, the animation clock.
world desktop-widget {
include widget;
export desktop-module;
}
/// Sample desktop module: app icons on the desktop. Click one to start the app, drag it to
/// arrange the grid (positions are kept as a hidden setting); arrow keys, Enter and typing pick
/// one. Its settings choose how many apps and how big.
world icon-desktop-widget {
include desktop-widget;
import app-catalog;
import app-launch;
import icons;
export module-config;
}
/// Sample desktop module: an animated starfield replacing the wallpaper. The pointer steers it,
/// the wheel changes speed, a click sends a warp pulse; it animates at 30 frames a second and
/// sleeps when its settings say Still.
world starfield-widget {
include desktop-widget;
export module-config;
}