# 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.