Skip to content

Add Chromium as an opt-in browser engine - #120

Open
aaronmayeux wants to merge 5 commits into
puterboy:testingfrom
aaronmayeux:feat/chromium-browser-option
Open

aaronmayeux wants to merge 5 commits into
puterboy:testingfrom
aaronmayeux:feat/chromium-browser-option

Conversation

@aaronmayeux

Copy link
Copy Markdown

Follows up on #118. Adds a browser: luakit|chromium option, default luakit — existing setups unchanged. Chromium is opt-in.

WebKitGTK hard-hangs on Intel Iris Xe (i915 GPU HANG in dmesg); Chromium runs clean on the same box. @YogatBear also tested this branch on a 4GB RPi and it fixed several luakit issues for them, including #56, with negligible RAM cost.

What's in it:

  • config.yaml — browser option (default luakit)
  • run.sh — conditional launch/flags; chromium first-run nag suppressed
  • rest_server.py — chromium navigate/refresh via CDP so launch_url/refresh_browser still work
  • cdp_auth.py — token-inject login over trusted loopback (no on-screen login)
  • kiosk_overlay.py — back-to-dashboard button for kiosk-out pages
  • run.sh (2nd commit) — fixes Onboard onscreen-keyboard on chromium, gated so luakit is untouched. luakit auto-show path unchanged but not re-tested on my hardware.
  • README / CHANGELOG / translations

Tested: Beelink EQi12 / Iris Xe / 43" touchscreen panel — boot, live WebRTC cameras, gestures, screen-off, survives restart. Plus @YogatBear's RPi.

Note: Alpine chromium isn't available on armhf/i386 — that path arch-guards and errors gracefully; luakit stays available everywhere.

aaronmayeux and others added 5 commits June 26, 2026 00:26
Adds a backward-compatible `browser: luakit|chromium` option (default
luakit, so existing setups are unchanged). Validated on x86_64 / Intel
Iris Xe, where luakit's WebKitGTK ThreadedCompositor hard-hangs the GPU
(live i915 GPU HANG in dmesg) while chromium composites cleanly.

- config.yaml: `browser` in options + schema (list(luakit|chromium))
- run.sh: conditional BROWSER/BROWSER_FLAGS; parameterized watch-loop
  process match for chromium's path-prefixed cmdline; first-run/sign-in
  suppression via a managed policy (BrowserSignin:0) + --no-first-run
- Dockerfile: opt-in BUILD_BROWSER=chromium build-arg to bake chromium
  at build time (default no-op; the luakit image is byte-unchanged).
  Arch-available for aarch64/armv7/x86/x86_64 (not armhf/i386)
- rest_server.py: per-browser navigate/refresh -- chromium drives CDP
  Page.navigate/reload so launch_url/refresh_browser work for both
- cdp_auth.py: hands-off auth helper -- injects a session token over the
  DevTools port so the kiosk lands authenticated (form-fill fallback for
  non-trusted_networks setups is a TODO)
- kiosk_overlay.py: in-page back-to-dashboard button injected into
  kiosk-out pages (works on external pages too; composited, no X overlay)
Adds a Browser option entry and a Chromium Browser Engine section to the README (rationale, CDP control, the two helper daemons, the trusted_networks auth requirement, and the not-yet-implemented form-fill fallback), a CHANGELOG entry, and a config-UI description in translations/en.yaml.
Chromium shipped with the onscreen keyboard structurally broken: tapping a
web text field (e.g. Google Maps/Earth search) would not raise Onboard, so
users could not type. Root cause was two coordinated bugs, both fixed here
and both gated on `browser=chromium && onscreen_keyboard=true` so luakit
users and keyboard-off kiosks (e.g. low-end Pis) are unaffected:

1. run.sh exported NO_AT_BRIDGE=1 unconditionally. That was added for
   luakit/GTK stability, but it kills the AT-SPI bridge Onboard listens on
   for text-field focus events. Now unset only under the chromium+keyboard
   gate; still exported (luakit stability) otherwise.

2. Chromium's sandboxed renderer emits no accessibility events until forced,
   so Onboard never hears a focus event even with the bridge up. Append
   --force-renderer-accessibility=complete under the same gate, keeping the
   a11y-tree CPU/RAM cost off systems that don't use the keyboard.

Confirmed on glass: Beelink EQi12 / Iris Xe / 43" touch panel — tap a field
in Maps/Earth and Onboard auto-pops.

Note: the luakit auto-show path is unchanged by this commit but was not
re-tested on this hardware; flagging for maintainer review.
Page.reload with ignoreCache is not enough on Home Assistant. The frontend
registers a service worker and HA serves /local/ with max-age 31d, so the
SW answers from cache storage and the reload returns stale assets -- the
visible symptom is refresh_browser appearing to do nothing after an edit
to a custom card or other /local/ resource.

_cdp_hard_refresh() clears the HTTP cache, then service workers and cache
storage for the HA origin, then reloads -- all over one WebSocket session
rather than reconnecting per command. The luakit path (ctrl+r) is
unchanged. _cdp_command() is untouched and still used by launch_url.
The overlay and the Chromium policy file carried naming and styling from
the dashboard they were first written for. Nothing functional changes;
this is so the feature reads as part of the add-on rather than as one
user's private setup.

- button label WALL -> DASHBOARD
- element id wall-kiosk-back -> haoskiosk-back, onWall -> onDash
- drop the hardcoded #0E1116 and the Lato font stack for a neutral
  #1c1c1c and system-ui; the style string is a single inline attribute
  and is still the documented place to restyle the button
- chromium policy file wall-kiosk.json -> haoskiosk.json (run.sh and
  both README copies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant