CI / test (push) Failing after 49s
- Replace the in-process GTK3 run_gui() with run_worker(), which owns the camera engine. - Worker streams downscaled Cairo BGRA frames to stdout, with a length header per frame. - Worker reads UI commands from stdin (switch, snap, snap_full, rec_start, quit) and emits state lines (info, active, flash, toast, saved_photo, rec_state). - SIGINT/SIGTERM set a stop flag so the worker shuts down cleanly.
53 lines
6.4 KiB
Markdown
53 lines
6.4 KiB
Markdown
# Handset & Touch Support
|
||
|
||
Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux smartphones (verified on OnePlus 6T `oneplus,fajita` at `1080x2340`).
|
||
|
||
## Display Scaling (`CHANDRA_SCALE`)
|
||
|
||
- Integer scaling lives in [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c).
|
||
- Setting `CHANDRA_SCALE=N` (or the default automatic `2x` scaling on dense portrait phone panels such as `1080x2340`) runs the compositor at a legible `540x1170` logical resolution while presenting `Nx` nearest pixels to hardware dumb buffers and cursor planes.
|
||
|
||
## 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`).
|
||
|
||
## 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.
|
||
|
||
## 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`).
|
||
- **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.
|
||
|
||
## Client-Side Window Controls (Chromium / GTK)
|
||
|
||
- [`compositor/wayland/server.mbt`](../compositor/wayland/server.mbt) emits `xdg_toplevel.wm_capabilities` (`window_menu`, `maximize`, `fullscreen`, `minimize`) for `xdg_wm_base` v5+ clients so client-decorated apps expose Maximize alongside Close.
|
||
- On GTK/Chromium setups where GNOME defaults (`org.gnome.desktop.wm.preferences button-layout`) omit maximize/minimize (e.g. `'appmenu:close'`), configure GTK and `gsettings`:
|
||
- `~/.config/gtk-3.0/settings.ini` and `~/.config/gtk-4.0/settings.ini`: `gtk-decoration-layout=:minimize,maximize,close`
|
||
- `gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'`
|
||
|
||
## Keyring Unlock
|
||
|
||
- [`session/chandra-session`](../session/chandra-session) starts `gnome-keyring-daemon --start --components=secrets` and unlocks an unencrypted default `login.keyring` at login over D-Bus (`org.freedesktop.Secret.Service.Unlock`) so apps such as Chromium store credentials without blocking prompts.
|
||
|
||
## Power Button & Brightness
|
||
|
||
- **Power key blank/wake:** Pressing `KEY_POWER` (`116`) in [`compositor/host/compositor.mbt`](../compositor/host/compositor.mbt) toggles manual screen blanking (`DPMS` off/on + touch cancellation in [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c)) while ignoring stray touches during blanking. Also controllable via `chandra-ctl screen [on|off|toggle|status]`. (Set `HandlePowerKey=ignore` in `/etc/systemd/logind.conf.d/` so `logind` does not power off immediately.)
|
||
- **Settings Brightness slider:** [`compositor/shell/backlight.mbt`](../compositor/shell/backlight.mbt) reads `/sys/class/backlight/` (`ae94000.dsi.0`, `CHANDRA_BACKLIGHT` override) and writes changes via sysfs or `org.freedesktop.login1.Session.SetBrightness`. When a backlight device exists, **Settings > Power > Brightness** shows a `-` / slider / `+` control (`5%..100%`), also accessible via `chandra-ctl brightness [PCT|status]`.
|
||
|
||
## Face Unlock (`libcamera`)
|
||
|
||
- On phones whose MIPI sensors (`imx371`, `imx519`, `imx376`) require `libcamera` SoftISP rather than raw V4L2 nodes, [`face/chandra-face`](../face/chandra-face) supports `libcamera:<camera-id>` entries via `python-libcamera` and applies `libcamera.properties.Rotation`. [`face/install.py`](../face/install.py) supports `--system-python` to run with system `python-opencv` + `python-numpy` on `aarch64`, and [`face/polkit-agent-helper.conf`](../face/polkit-agent-helper.conf) grants `char-video4linux`, `char-media`, and `char-dma_heap` access to polkit's helper sandbox.
|
||
|
||
## Camera App (`chandra-camera`)
|
||
|
||
- [`camera/chandra-camera`](../camera/chandra-camera) and [`camera/chandra-camera-ui.c`](../camera/chandra-camera-ui.c) provide a native GTK3/Cairo Wayland camera app (no extra Python GI packages required) installed via [`session/install.py`](../session/install.py) with its desktop launcher and icon (`Camera`).
|
||
- Supports multi-sensor `libcamera` discovery and live switching (`Back · imx519`, `Front · imx371`, `Back 2 · imx376` on OnePlus 6T, with automatic V4L2 fallback on desktops), sensor orientation transform + front-camera mirror preview, Photo mode (`HD` instant / `Full` high-resolution `StillCapture`, `0`/`3s`/`10s` self-timer, 3×3 rule-of-thirds grid) saving JPEGs to `~/Pictures/Camera`, Video mode recording H.264 MP4s via `ffmpeg` to `~/Videos/Camera`, an in-app photo gallery viewer, rear flash/torch LED control (`/sys/class/leds/white:flash`) through `org.freedesktop.login1.Session.SetBrightness`, and hardware volume-button or `Space`/`Return` shutter control.
|