Lock: add session lock from power button and chandra-ctl lock
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
This commit is contained in:
nandi committed 2026-11-29 03:24:46 -08:00
1 parent 7501fc3ad9
commit c790f96e58
131 files changed
+4693 -274

No files matched your search

+35
View File
@@ -594,3 +594,38 @@ test "face unlock: Chandra's and Howdy's PAM messages" {
assert_eq(@polkit.face_message("Place your finger on the fingerprint reader", false), None)
assert_eq(@polkit.face_message("The account is locked due to 3 failed logins.", true), None)
}
///|
test "process_subject_for parses /proc/<pid>/stat with spaces/parens and /proc/<pid>/status Uid" {
let stat = "4210 (chandra (polkit) agent) S 1 4210 4210 0 -1 4194304 100 0 0 0 1 0 0 0 20 0 1 0 987654321 12345 100"
let status = "Name:\tchandra-polkit\nState:\tS (sleeping)\nUid:\t1000\t1000\t1000\t1000\nGid:\t1000\t1000\t1000\t1000\n"
let subj = @polkit.process_subject_for(4210, stat, status)
assert_eq(
subj,
@network.DValue::Struct([
Str("unix-process"),
@network.dict("v", [
("pid", Variant(U32(4210U))),
("start-time", Variant(U64(987654321UL))),
("uid", Variant(I32(1000))),
]),
]),
)
}
///|
test "describe: org.chandra.unlock uses clear lock-screen wording" {
let req : @polkit.AuthRequest = {
action_id: "org.chandra.unlock",
message: "Authenticate to unlock the screen",
icon_name: "",
details: {},
cookie: "c-unlock",
users: [{ uid: 1000, name: "nandi", real_name: "Nandi" }],
}
let desc = @polkit.describe(req, cmdline=_ => [], who=_ => "")
assert_eq(desc.title, "Screen locked")
assert_eq(desc.subtitle, "Look at the camera or enter your password to unlock.")
assert_eq(desc.command, "")
assert_eq(desc.details, [("Action", "org.chandra.unlock")])
}