- 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:
1 parent
7501fc3ad9
commit
c790f96e58
131 files changed
+4693
-274
No files matched your search
+3
-5
@@ -10,19 +10,17 @@ Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux
|
||||
## Icon Desktop & Compact Panel
|
||||
|
||||
- **Icon desktop default:** Portrait handset layouts prioritize the touch-friendly icon desktop launcher aesthetic.
|
||||
- **Compact panel layout:** Panel items (`launcher`, `dock`, `session-settings`, `network`, `battery`, `clock-digital`, `screenshot`) size compactly so all controls fit cleanly within `540px` portrait width without clipping, with fuel-gauge support (e.g. `bq27411-0`).
|
||||
- **Compact panel layout:** Panel items (`launcher`, `dock`, `session-settings`, `network`, `battery`, `clock-digital`, `screenshot`, `rotate`, `osk`) size compactly so all controls fit cleanly within `540px` portrait width without clipping, with fuel-gauge support (e.g. `bq27411-0`).
|
||||
|
||||
## Touch Input & On-Screen Keyboard
|
||||
|
||||
- **Long-press right-click:** In [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c), a stationary touch held for `500 ms` converts to a synthetic right-click (`BTN_RIGHT`) via a `timerfd`, allowing context menus and secondary actions without a mouse.
|
||||
- **Built-in OSK:** [`compositor/host/osk.mbt`](../compositor/host/osk.mbt) provides a 5-row virtual keyboard that opens automatically when Wayland text input (`zwp_text_input_v3`) gains focus and can also be toggled manually from the bottom-right **`KB`** pill. It sits directly above the panel, so the panel stays visible and usable while typing (a strict kiosk has no panel: there it reaches the bottom edge).
|
||||
- **Built-in OSK:** [`compositor/host/osk.mbt`](../compositor/host/osk.mbt) provides a 5-row virtual keyboard that opens automatically when Wayland text input (`zwp_text_input_v3`) gains focus and can also be toggled manually from the **`KB`** (`osk`) panel module. It sits directly above the panel, so the panel stays visible and usable while typing (a strict kiosk has no panel: there it reaches the bottom edge).
|
||||
|
||||
## Display Rotation, Flip, and Auto-Rotate
|
||||
|
||||
- **4-way transform (`0°`, `90° CW`, `180°`, `270° CW`):** Handled end-to-end across [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c), [`wit/host/display.wit`](../wit/host/display.wit), [`wasmhost/bin/display.mbt`](../wasmhost/bin/display.mbt), and the compositor event loop (`CHANDRA_ROTATE` sets the initial orientation). Both scanout rows and libinput touch/pointer coordinates transform to match the active orientation.
|
||||
- **Touch `Rot` pill:** Sitting left of the `KB` pill in [`compositor/host/osk.mbt`](../compositor/host/osk.mbt):
|
||||
- **Tap:** rotate `90°` clockwise (`0 -> 90 -> 180 -> 270 -> 0`).
|
||||
- **Long-press / right-click:** flip `180°` (`0 <-> 180`, `90 <-> 270`).
|
||||
- **Touch `Rot` (`rotate`) panel module:** Sits in the panel beside `KB` (`osk`) and rotates `90°` clockwise on tap (`0 -> 90 -> 180 -> 270 -> 0`). Both `rotate` and `osk` are ordinary panel modules that can be reordered, removed, or added on any desktop from **Settings > Panel**.
|
||||
- **CLI control:** `chandra-ctl rotate [cw|ccw|flip|0|90|180|270|status]` queries or changes rotation live (`0` portrait, `90` / `270` landscape, `180` inverted).
|
||||
- **Sensor auto-rotate:** When running on the DRM backend (`chandra-session`) with `monitor-sensor` (`iio-sensor-proxy`) installed, [`session/chandra-auto-rotate`](../session/chandra-auto-rotate) runs inside the active `seat0` session and applies orientation change events (`normal -> 0`, `right-up -> 90`, `bottom-up -> 180`, `left-up -> 270`) without fighting manual `Rot` taps while stationary. Set `CHANDRA_AUTO_ROTATE=0` in the session environment to disable auto-rotate.
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# Locking the screen
|
||||
|
||||
Chandra can lock the session: the desktop is hidden and nothing but the unlock prompt gets
|
||||
input until a **face** (or, as the fallback, your **password**) lets you back in. It reuses the
|
||||
password dialog ([auth-dialog.md](auth-dialog.md)) and face unlock ([face-unlock.md](face-unlock.md)),
|
||||
so there is no second lock UI to configure.
|
||||
|
||||
## Turn it on
|
||||
|
||||
Locking on screen-off is **off by default** so a half-set-up machine can't lock you out. Turn it
|
||||
on by setting `CHANDRA_LOCK=1` in the session environment or toggling it at runtime via
|
||||
`chandra-ctl lock on-blank on`; then pressing the **power button** (or `chandra-ctl screen off`) to
|
||||
blank the screen also locks it, and waking the screen asks for your face or password.
|
||||
|
||||
`chandra-ctl lock` locks immediately, regardless of the setting (handy to bind to a key or a
|
||||
panel button).
|
||||
|
||||
```sh
|
||||
chandra-ctl lock # lock now
|
||||
chandra-ctl lock status # locked | unlocked
|
||||
chandra-ctl lock on-blank on # arm lock-on-blank at runtime (on | off | status)
|
||||
```
|
||||
|
||||
**Before you enable it, make sure you can get back in:** enroll a face
|
||||
(`chandra-face enroll`, or Settings > Session > Face unlock) and/or confirm your login password
|
||||
works, and that face unlock is in the `polkit-1` PAM stack (`chandra-face pam enable polkit-1`,
|
||||
which `just install --pam` does). If neither the camera nor the password can authenticate, the
|
||||
session stays locked and only an SSH login can recover it.
|
||||
|
||||
## How it works
|
||||
|
||||
```
|
||||
power off / chandra-ctl lock
|
||||
│
|
||||
▼
|
||||
compositor: locked ──"unlock"──► chandra-polkit-agent
|
||||
• hides windows/panel │ CheckAuthorization(unix-process, org.chandra.unlock)
|
||||
• swallows input ▼
|
||||
• dark lock backdrop polkit ──► this agent's dialog: face (PAM), then password
|
||||
• draws the unlock dialog │
|
||||
▲ │
|
||||
└────────── "unlocked" ◄──────┘ (success) "unlock-failed" ◄── (cancel / fail)
|
||||
```
|
||||
|
||||
- **Locking** is in [`compositor/host/lock.mbt`](../compositor/host/lock.mbt). The power button
|
||||
([`compositor/host/compositor.mbt`](../compositor/host/compositor.mbt), `handle_input_inner`,
|
||||
key `116`) and `chandra-ctl screen` route through `set_manual_screen_off` in
|
||||
[`compositor/host/power.mbt`](../compositor/host/power.mbt); `lock_on_blank` (from `CHANDRA_LOCK`
|
||||
or `chandra-ctl lock on-blank`) decides whether blanking also locks. Blanked again while unlock
|
||||
is in flight, the compositor sends `cancel-unlock` so polkit and the camera stop immediately.
|
||||
While locked, `build_scene` hides windows, popups, desktop widgets, and the panel behind a dark
|
||||
`"Screen locked"` backdrop, and `handle_input_inner` swallows input (re-raising unlock only on
|
||||
a key or button press when no dialog is up).
|
||||
- **Unlocking** runs in the polkit agent
|
||||
([`compositor/polkit/agent_loop.mbt`](../compositor/polkit/agent_loop.mbt),
|
||||
[`agent.mbt`](../compositor/polkit/agent.mbt)): once registered with polkit, on an `unlock`
|
||||
message it passes a `unix-process` subject (`pid`, `start-time`, `uid` from `/proc`) to
|
||||
`CheckAuthorization` for **`org.chandra.unlock`** with `AllowUserInteraction` (and cancels via
|
||||
`CancelCheckAuthorization` on `cancel-unlock`). polkit then drives the agent's own dialog, and
|
||||
because the `polkit-1` PAM stack carries `pam_chandra_face.so` the camera is tried first, with
|
||||
the password as the fallback. The action is `auth_self` (never `_keep`), so it prompts every
|
||||
time and nothing is cached.
|
||||
- The policy file is
|
||||
[`compositor/polkit/org.chandra.unlock.policy`](../compositor/polkit/org.chandra.unlock.policy),
|
||||
installed to `/usr/share/polkit-1/actions/` by `session/install.py`.
|
||||
|
||||
## Limits (today)
|
||||
|
||||
- Lock-on-idle isn't wired yet — only the power button, `chandra-ctl screen off`, and
|
||||
`chandra-ctl lock` lock. (The idle timeout still blanks the screen without locking.)
|
||||
- The idle lock backdrop is a minimal padlock card ("Screen locked") rather than a custom clock or
|
||||
wallpaper clock widget.
|
||||
- Cancelling the unlock prompt keeps you locked (the desktop stays hidden); the next key press or
|
||||
screen tap raises the prompt again.
|
||||
Reference in new issue
Block a user