Every touch was turned into a mouse drag in the seat code, which selects text instead of scrolling. The seat now reports raw touches and the compositor routes them: to the app as wl_touch on its own content, and to the pointer (tap, drag, hold for right click, as before) everywhere else and for apps that don't listen to touches. The cursor is hidden while fingers are in use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 KiB
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. - Setting
CHANDRA_SCALE=N(or the default automatic2xscaling on dense portrait phone panels such as1080x2340) runs the compositor at a legible540x1170logical resolution while presentingNxnearest 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,rotate,osk) size compactly so all controls fit cleanly within540pxportrait width without clipping, with fuel-gauge support (e.g.bq27411-0).
Touch Input & On-Screen Keyboard
- Touch goes to apps as touch (
wl_touch): a finger on an app's own content is the app's: it scrolls with a thumb, flings, pinches and long-presses as that app does (compositor/host/touch.mbt). The seat only says it has a touchscreen when libinput finds one. If the app answers a touch with a window move, resize or drag and drop, its touch is cancelled and the finger drags from there. - Elsewhere a finger is a mouse: on the panel, the on-screen keyboard, the desktop, title bars, dialogs, and apps that don't listen to touches, a tap clicks, a drag is a left-button drag, and a stationary touch held for
500 msis a right click. - Cursor: hidden while fingers are in use; moving a mouse shows it again.
- Testing:
chandra-ctl input-touch down ID X Y,motion ID X Y,up ID,cancelact like the touchscreen. - Built-in OSK:
compositor/host/osk.mbtprovides 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 theKB(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 acrosscompositor/kms/kms_stub.c,wit/host/display.wit,wasmhost/bin/display.mbt, and the compositor event loop (CHANDRA_ROTATEsets the initial orientation). Both scanout rows and libinput touch/pointer coordinates transform to match the active orientation. - Touch
Rot(rotate) panel module: Sits in the panel besideKB(osk) and rotates90°clockwise on tap (0 -> 90 -> 180 -> 270 -> 0). Bothrotateandoskare 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 (0portrait,90/270landscape,180inverted). - Sensor auto-rotate: When running on the DRM backend (
chandra-session) withmonitor-sensor(iio-sensor-proxy) installed,session/chandra-auto-rotateruns inside the activeseat0session and applies orientation change events (normal -> 0,right-up -> 90,bottom-up -> 180,left-up -> 270) without fighting manualRottaps while stationary. SetCHANDRA_AUTO_ROTATE=0in the session environment to disable auto-rotate.
Client-Side Window Controls (Chromium / GTK)
compositor/wayland/server.mbtemitsxdg_toplevel.wm_capabilities(window_menu,maximize,fullscreen,minimize) forxdg_wm_basev5+ 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 andgsettings:~/.config/gtk-3.0/settings.iniand~/.config/gtk-4.0/settings.ini:gtk-decoration-layout=:minimize,maximize,closegsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
Keyring Unlock
session/chandra-sessionstartsgnome-keyring-daemon --start --components=secretsand unlocks an unencrypted defaultlogin.keyringat 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) incompositor/host/compositor.mbttoggles manual screen blanking (DPMSoff/on + touch cancellation incompositor/kms/kms_stub.c) while ignoring stray touches during blanking. Also controllable viachandra-ctl screen [on|off|toggle|status]. (SetHandlePowerKey=ignorein/etc/systemd/logind.conf.d/sologinddoes not power off immediately.) - Settings Brightness slider:
compositor/shell/backlight.mbtreads/sys/class/backlight/(ae94000.dsi.0,CHANDRA_BACKLIGHToverride) and writes changes via sysfs ororg.freedesktop.login1.Session.SetBrightness. When a backlight device exists, Settings > Power > Brightness shows a-/ slider /+control (5%..100%), also accessible viachandra-ctl brightness [PCT|status].
Audio & Volume Buttons
- Audio stack (PipeWire + WirePlumber + OnePlus 6T UCM2):
pipewire,wireplumber,pipewire-pulse, andpipewire-alsadrive the OnePlus 6T (fajita) ALSA UCM2HiFiprofile (Speaker,Headphones,Mic1/Mic2,Headset), with Qualcomm buffer tuning from51-qcom.conf. - Hardware volume keys:
compositor/host/volume.mbtbindsVolumeUp(KEY_VOLUMEUP/115),VolumeDown(KEY_VOLUMEDOWN/114), andMute(KEY_MUTE/113) incompositor/shell/shortcuts.mbtto asyncwpctl(withpactlfallback) commands:5%step per press, unmuting on volume up and capping hardware button increases at100%.- Hold-to-repeat after
400 ms(90 mscadence) until key release. - Works while the display is blanked (
screen_off/manual_screen_off) without waking the screen. - Passes
VolumeUp/VolumeDownstraight through tochandra-camerawhen it is the active foreground window (with no modal/popup/modifier) so the hardware buttons keep acting as the camera shutter. - Shows a floating top-center Volume OSD pill (
1.8 s) when the screen is on, and exposeschandra-ctl volume [up|down|mute|unmute|toggle|PCT|status].
- Mixer GUI (
moonmix):org.latha.moonmixprovides a GTK4 +libwireplumbervolume mixer (Playback, Recording, Output Devices, Input Devices) integrated into the launcher.
Face Unlock (libcamera)
- On phones whose MIPI sensors (
imx371,imx519,imx376) requirelibcameraSoftISP rather than raw V4L2 nodes,face/chandra-facesupportslibcamera:<camera-id>entries viapython-libcameraand applieslibcamera.properties.Rotation.face/install.pysupports--system-pythonto run with systempython-opencv+python-numpyonaarch64, andface/polkit-agent-helper.confgrantschar-video4linux,char-media, andchar-dma_heapaccess to polkit's helper sandbox.
Camera App (chandra-camera)
camera/chandra-camera,camera/chandra-camera-ui.c, andcamera/chandra-camera-isp.cprovide a native GTK3/Cairo Wayland camera app with a C/OpenMP Quad-Bayer ISP library (libchandra-camera-isp.so) installed viasession/install.pywith its desktop launcher and icon (Camera).- Heat: the viewfinder decodes half-size frames at 24 fps (15 on the raw front camera); photos, video, focusing and QR scans take full frames (
CameraEngine.grab_full_frame). - QR scanner: in photo mode the camera reads QR codes with OpenCV's own detectors about twice a second (the QR pill turns it off). A card shows the text with Open (web links), Join (WPA and open
WIFI:codes, through NetworkManager) and Copy; nothing is opened or joined before a tap. - Supports multi-sensor
libcameradiscovery and live switching (Back · imx519,Front · imx371,Back 2 · imx376on OnePlus 6T, with automatic V4L2 fallback on desktops), sensor orientation transform + front-camera mirror preview,libcameraSoftISP CCM tuning (camera/ipa/simple/*.yaml), VCM contrast autofocus with tap-to-focus (lc898217xc), Photo mode (HDinstant /Fullhigh-resolutionStillCaptureor 3-frame raw burst merge on Quad-Bayer,0/3s/10sself-timer, 3×3 rule-of-thirds grid) saving JPEGs to~/Pictures/Camera, Video mode recording exact-PTS VFR H.264 MP4s (MatroskaI420Muxer+ffmpeg) to~/Videos/Camera, an in-app photo gallery viewer, rear flash/torch LED control (/sys/class/leds/white:flash) throughorg.freedesktop.login1.Session.SetBrightness, and hardware volume-button orSpace/Returnshutter control.
Remote Control Over Tailscale (chandra-remote)
remote/chandra-remote.cprovides a zero-overhead shared-memory framebuffer mirror (fb.shminwasmhost/bin/raster_stub.c) feeding both:- VNC (RFB 3.8, port
5900) with Tight-JPEG (libturbojpeg), Zlib, Raw, dynamic rotation resize (ExtendedDesktopSize), clipboard sync, and 1:1 pointer/touch/keyboard input (tested for Android AVNC). - Mobile Web UI / PWA (HTTP + WebSocket, port
6080) with 1:1 touch gestures (tap, drag, long-press right-click, two-finger scroll/right-click), mouse right-click, optional trackpad mode, Android keyboard bridge, live rotation/brightness/OLED-off toggles, and adaptive JPEG streaming.
- VNC (RFB 3.8, port
- Paste (web UI):
Ctrl+V,Ctrl+Shift+V,Shift+Insert(Cmd+Von a Mac) put this device's clipboard, text or an image (up to 16 MB, sent as PNG), on the phone's and then press the same keys there. This works over plain HTTP. If something was copied on the phone since the page was last focused, that is pasted instead. The Paste button (KBbar) and Paste Image… (menu) do the same, withCtrl+Shift+Vfor text in terminals. In the launcher and the password dialog the text is typed in. The browser uploads toPOST /api/clipboard; the compositor gets the data as a memfd over the control socket (clipboard-set-fd,input-paste). VNC clients can send text only. https://chandra-6t.tail.site.latha.org/serves the web UI over HTTPS, tailnet only, from thechandra-remotechart innandi/cluster(Caddy on the phone node, proxying to loopback6080).- By default (
~/.config/chandra/remote.conf),bind=tailscale,bind_loopback=1, andauth=none, binding strictly to the Tailscale100.64.0.0/10interface +127.0.0.1so any device on the same Tailscale tailnet can connect directly with zero password prompt (http://<tailscale-dns>:6080/or<tailscale-dns>:5900), even while the handset's physical OLED screen is turned off (chandra-ctl screen off). Runchandra-remote statusto inspect endpoints orchandra-remote passwd [PASS|--none]to configure optional password auth.
Deploying to the phone
Every push to main builds an arm64 image (handset/Dockerfile) and deploys it with the chandra-handset chart in nandi/cluster; the phone is a k3s node, so no SSH or root password is involved. The updater (handset/handset.sh) installs chandra-remote and its page at once, without ending the session. The compositor, its host and the panel modules need a session restart, so they wait until the phone has been locked with its screen off for 10 minutes, or until approved:
kubectl -n chandra-handset exec deploy/chandra-handset -- handset status
kubectl -n chandra-handset exec deploy/chandra-handset -- handset approve # closes the phone's apps
A locked session restarts locked (/run/chandra-start-locked), and a session that doesn't come up is rolled back. The image build runs a smoke test (compositor, image paste) and the updater's tests (handset/test_handset.sh).