You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: auto-toggle Chromium app mode for small viewports (#153)
## Summary
- Automatically enables Chromium `--app` mode when the requested display
width < 500px or height < 200px, removing the tab/toolbar chrome that
enforces a ~500px minimum window width
- Adds `RemoveFlagsByPrefix` and `HasFlagWithPrefix` helpers to the
`chromiumflags` package for dynamic flag management
- Adds manually crafted modelines for exact 390x844 (iPhone 14/15) and
768x1024 (tablet) viewports at 60/30/25 Hz, bypassing CVT's
multiple-of-8 width convention since the Xorg dummy driver doesn't
require it
## Context
Chromium enforces a minimum window size of approximately 500px wide due
to the tab bar and toolbar chrome. Launching with `--app=<url>` removes
this chrome, allowing the window to resize to mobile viewports like
390x844. The `PatchDisplay` endpoint now automatically toggles this flag
based on the requested dimensions and restarts Chromium when needed.
The modelines use exact pixel widths (e.g. 390 instead of 392) with
manually calculated timing parameters that keep the pixel clock above
the Xorg dummy driver's 11 MHz minimum. CVT's convention of rounding
widths to multiples of 8 is a standard for real monitor compatibility —
the dummy driver is more permissive.
Depends on kernel/neko#11 for correct width
handling (removes Neko's Go-level rounding that was truncating 390 →
384).
## Test plan
- [x] `PATCH /display` with `{"width": 390, "height": 844}` — enables
app mode, display is exactly 390x844
- [x] `PATCH /display` with `{"width": 768, "height": 1024}` — no app
mode, display is 768x1024
- [x] `PATCH /display` with `{"width": 1920, "height": 1080}` — disables
app mode if previously enabled
- [x] Verify `RemoveFlagsByPrefix` and `HasFlagWithPrefix` unit tests
pass
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes runtime Chromium flag management and automatically triggers
restarts based on viewport size, which can impact session stability and
resize behavior; also updates Neko/image dependencies that affect
display handling.
>
> **Overview**
> Automatically toggles Chromium *app mode* during `PATCH /display`:
when the requested size is below `500x200`, the API adds
`--app=https://start.duckduckgo.com` to the runtime flags and forces a
Chromium restart; when returning to normal sizes it removes the flag.
>
> Refactors Chromium runtime flag writing around a shared
`chromiumFlagsPath` constant + `writeChromiumFlags`, adds
`chromiumflags.RemoveFlagsByPrefix`/`HasFlagWithPrefix` helpers (with
new tests), and extends the headful Xorg dummy config with exact
`390x844` (iPhone) and `768x1024` modelines at 60/30/25 Hz. Also bumps
the `neko` base image/dependency version and ignores the built
`chromium-launcher` binary in `server/.gitignore`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9e9dfdf. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
0 commit comments