Skip to content

Conversation

@hiroTamada
Copy link
Contributor

@hiroTamada hiroTamada commented Feb 12, 2026

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

  • PATCH /display with {"width": 390, "height": 844} — enables app mode, display is exactly 390x844
  • PATCH /display with {"width": 768, "height": 1024} — no app mode, display is 768x1024
  • PATCH /display with {"width": 1920, "height": 1080} — disables app mode if previously enabled
  • Verify RemoveFlagsByPrefix and HasFlagWithPrefix unit tests pass

Note

Medium Risk
Touches display-resize and Chromium restart/flag-writing paths and upgrades the Neko base image/dependency, which could affect runtime stability across Xorg/Xvfb environments.

Overview
PATCH /display now auto-toggles Chromium app mode for small viewports. When the requested width/height falls below thresholds, the API updates /chromium/flags to add/remove --app=... and forces a Chromium restart when the flag state changes.

Adds flag-management helpers and display modes to support exact small resolutions. Introduces chromiumflags.RemoveFlagsByPrefix/HasFlagWithPrefix (with tests) for safe prefix-based flag edits, expands xorg.conf with new 390x844 and 768x1024 modelines at 60/30/25Hz and includes them in allowed Modes, and bumps the Neko base image/dependency to versions that support the new resolution behavior.

Written by Cursor Bugbot for commit 370b0a5. This will update automatically on new commits. Configure here.

var updated []string
if enable {
log.Info("enabling app mode (--app=about:blank) for small viewport")
updated = append(existing, "--app=https://start.duckduckgo.com")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log message contradicts actual app flag URL value

Medium Severity

The log message on line 436 says "enabling app mode (--app=about:blank)" but the actual flag appended on line 437 is "--app=https://start.duckduckgo.com". The docstring on line 410 also incorrectly states --app=about:blank. This makes debugging misleading — an operator inspecting logs would believe about:blank is being used when start.duckduckgo.com is being loaded instead.

Additional Locations (1)

Fix in Cursor Fix in Web

}
}
return false
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New hasAppFlag function is unused dead code

Low Severity

The hasAppFlag function is defined and tested but never called from any production code path. It also duplicates the functionality of chromiumflags.HasFlagWithPrefix, which is the function actually used in ensureAppMode. This is dead code that adds maintenance burden without providing value.

Fix in Cursor Fix in Web

Chromium's minimum window size (~500px wide, ~200px tall) prevents
resizing to mobile viewports like 390x844. Launching with --app mode
removes the tab bar and toolbar chrome, allowing smaller windows.

Changes:
- PatchDisplay now automatically enables --app=https://start.duckduckgo.com
  when width < 500 or height < 200, and disables it for larger sizes
- Add ensureAppMode() to toggle the --app flag in the runtime flags file
  and trigger a Chromium restart when the flag state changes
- Add RemoveFlagsByPrefix and HasFlagWithPrefix helpers to chromiumflags
- Add hasAppFlag helper to chromium-launcher
- Add manually crafted modelines for 390x844 (exact iPhone 14/15 width,
  bypassing CVT's multiple-of-8 convention) and 768x1024 at 60/30/25 Hz

Co-authored-by: Cursor <cursoragent@cursor.com>
@hiroTamada hiroTamada force-pushed the feat/chromium-app-mode-small-viewports branch from 7b58986 to 157826e Compare February 13, 2026 01:21
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

# 768x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 65.13 MHz
Modeline "768x1024_60.00" 65.13 768 816 896 1024 1024 1025 1028 1060 -HSync +Vsync
# 390x844 @ 60.00 Hz (manual, non-CVT) pclk: 27.26 MHz (mobile: iPhone 14/15)
Modeline "390x844_60" 27.26 390 406 446 520 844 845 848 874 -HSync +Vsync
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modeline names don't match xrandr mode format

High Severity

The new 390x844 modelines are named 390x844_60, 390x844_30, and 390x844_25 (without .00 suffix), but setResolutionXorgViaXrandr constructs mode names using fmt.Sprintf("%dx%d_%d.00", ...), producing 390x844_60.00. This mismatch means xrandr will not find the mode and the resolution change will fail for mobile viewports — the primary use case of this PR. All other modelines (including the new 768x1024 ones) consistently use the _XX.00 suffix convention.

Additional Locations (2)

Fix in Cursor Fix in Web

Updates the neko base image and Go module dependency to include the
screen width rounding fix (kernel/neko#11).

Co-authored-by: Cursor <cursoragent@cursor.com>
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