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

+16 -3
View File
@@ -184,6 +184,10 @@ fn ChandraCompositor::auth_drop_link(self : ChandraCompositor, l : AuthLink) ->
Some(ui) if physical_equal(ui.link, l) => self.close_auth(false)
_ => ()
}
match self.auth_agent {
Some(a) if physical_equal(a, l) => self.unlock_pending = false
_ => ()
}
l.conn.close()
}
@@ -207,6 +211,7 @@ fn ChandraCompositor::auth_tick(self : ChandraCompositor) -> Unit {
Some(l) =>
if !self.auth_serve(l) {
self.auth_agent = None
self.unlock_pending = false
let why = if l.error != "" {
l.error
} else {
@@ -264,6 +269,9 @@ fn ChandraCompositor::auth_serve(self : ChandraCompositor, l : AuthLink) -> Bool
if !l.demo {
@sys.log("chandra: chandra-polkit-agent registered with polkit")
self.auth_slow_said = false
if self.locked && !self.manual_screen_off && !self.screen_off {
self.request_unlock()
}
}
}
"error" => {
@@ -271,6 +279,9 @@ fn ChandraCompositor::auth_serve(self : ChandraCompositor, l : AuthLink) -> Bool
@sys.log("chandra: chandra-polkit-agent: " + l.error)
}
"request" => l.view = Some(@polkit.AuthView::from_request(f))
// Session unlock (lock.mbt): the agent's org.chandra.unlock authorization resolved.
"unlocked" => if !l.demo { self.unlocked() }
"unlock-failed" => if !l.demo { self.unlock_failed() }
"close" => {
match self.auth {
Some(ui) if physical_equal(ui.link, l) && ui.view.id == f.get(1).unwrap_or("") => self.close_auth(false)
@@ -327,9 +338,11 @@ fn ChandraCompositor::close_auth(self : ChandraCompositor, dismiss : Bool) -> Un
ui.view.wipe()
self.auth = None
ui.link.view = None
match ui.prev_kbd {
Some(w) => if self.windows.contains(w) { self.set_kbd_focus(Some(w)) }
None => ()
if !self.locked {
match ui.prev_kbd {
Some(w) => if self.windows.contains(w) { self.set_kbd_focus(Some(w)) }
None => ()
}
}
self.osk_sync()
self.damage.mark_full()