Face unlock window: live camera preview, Snap, thumbnails, one password on Apply
CI / test (push) Failing after 12m30s

Settings > Session "Add or remove faces…" (and "Remove…" on a face) opens a
compositor-drawn Face unlock window instead of running root steps one by one:

- chandra-face camera runs as the user (no password): it streams a small live
  picture with the face box and a cropped thumbnail per snap; the snaps'
  embeddings stay in that process, nothing is written to disk.
- Click a snap to drop it; mark saved faces Remove/Keep.
- Apply saves the snaps as one face and removes the marked ones in one root
  `chandra-face apply` (JSON on stdin, validated) through run0/pkexec: one
  password prompt.
- New raster host function image-pixels (host-wasm, wasmhost, native) for the
  window's pictures.

Tests: camera session and apply in face/test_face.py; the window end to end
against a fake tool in compositor/host/face_test.mbt. Docs explain why the
change itself still needs root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
This commit is contained in:
Claude committed 2026-11-26 02:36:29 +00:00
1 parent 0a9787ae36
commit 9f7489cfea
74 files changed
+2617 -89

No files matched your search

+15
View File
@@ -193,6 +193,10 @@ pub(all) struct ChandraCompositor {
mut polkit_bus : String
mut auth : AuthUi?
auth_swallow : Array[UInt]
/// The Face unlock window (face_window.mbt): where its controls were drawn, and the change of
/// it last drawn.
face_hits : Array[(@scene.Rect, FaceHit)]
mut face_rev : Int
mut auth_routes : Array[@polkit.HelperRoute]
mut keymap : (Bytes, @polkit.Keymap)?
/// How requests are put into words (tests pass their own process lookups); None: the usual.
@@ -236,6 +240,8 @@ pub fn ChandraCompositor::new(
polkit_bus: "",
auth: None,
auth_swallow: [],
face_hits: [],
face_rev: -1,
auth_routes: [],
keymap: None,
auth_describe: None,
@@ -478,6 +484,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
self.kiosk_tick()
self.portal_tick()
self.auth_tick()
self.face_window_tick()
self.control_tick()
let events = self.server.poll_events()
for ev in events {
@@ -906,6 +913,7 @@ fn ChandraCompositor::build_scene(
panel_ops.append(self.switcher_ops())
}
panel_ops.append(self.screenshot_ops())
panel_ops.append(self.face_window_ops())
panel_ops.append(self.auth_ops())
self.frames_built = self.frames_built + 1
self.run_shell_actions()
@@ -1506,6 +1514,10 @@ pub fn ChandraCompositor::handle_input(
if self.auth_input(ev) {
return
}
// So does the Face unlock window (below the password dialog it opens on Apply).
if self.face_window_input(ev) {
return
}
match ev {
Key(code, pressed) => {
self.track_modifier_key(code, pressed)
@@ -1868,6 +1880,9 @@ pub fn ChandraCompositor::desired_cursor(self : ChandraCompositor) -> UInt {
Some(ui) => return self.auth_cursor(ui)
None => ()
}
if self.shell.face.window is Some(_) {
return if self.face_window_hit() is Some(_) { 4U } else { 1U }
}
match self.shot {
Some(o) => return self.overlay_cursor(o)
None => ()