Skip to content

Linux: Chromium CDP backend (zero-compile alternative to WebKitGTK)#8

Merged
HazAT merged 1 commit intoHazAT:mainfrom
hjanuschka:chromium-backend
Mar 20, 2026
Merged

Linux: Chromium CDP backend (zero-compile alternative to WebKitGTK)#8
HazAT merged 1 commit intoHazAT:mainfrom
hjanuschka:chromium-backend

Conversation

@hjanuschka
Copy link
Contributor

@hjanuschka hjanuschka commented Mar 20, 2026

New Linux backend that uses system Chromium via CDP pipe instead of WebKitGTK. No Rust, no GTK dev packages, no compile step -- just needs a browser installed.

When the native binary isn't built, Glimpse auto-falls back to spawning chromium --app --remote-debugging-pipe and talking CDP over FDs 3/4. A ~1k line Node script (src/chromium-backend.mjs) translates between our JSON Lines protocol and CDP. From the caller side nothing changes.

GLIMPSE_BACKEND=chromium node my-app.mjs  # force it
GLIMPSE_BACKEND=native node my-app.mjs    # force native
# or just don't build the Rust binary and it kicks in automatically

This also unlocks stuff the native Linux backend can't do:

  • Follow cursor on X11 (not just Hyprland) -- polls via xdotool, or Hyprland IPC natively via unix socket
  • Status item / system tray -- tiny inline Python GTK helper, click toggles a window
  • Open links externally -- intercepts navigations via CDP Fetch, hands off to xdg-open

Window modes work via X11 tooling after the Chrome window appears:

  • Frameless: _MOTIF_WM_HINTS removal via xprop
  • Floating: _NET_WM_STATE_ABOVE via xprop
  • Click-through: XFixes empty input shape via python3 ctypes
  • Transparent: Emulation.setDefaultBackgroundColorOverride

New backend that uses system Chromium/Chrome via CDP pipe as an
alternative to the Rust/GTK4/WebKitGTK native binary. Zero compilation,
zero native dependencies beyond a system browser.

- src/chromium-backend.mjs: standalone backend (~970 lines)
  Speaks Glimpse JSON Lines on stdin/stdout, translates to CDP over
  pipe (FDs 3/4) to a Chrome process launched with --app mode.

- Full feature parity with native backends:
  Window modes (frameless, floating, transparent, click-through)
  via xprop/xdotool/XFixes. Follow cursor on X11 via xdotool
  polling (not just Hyprland). Status item via GTK StatusIcon
  Python helper. Open links via xdg-open. Spring physics,
  cursor anchors, hidden/prewarm, auto-close.

- src/glimpse.mjs: auto-fallback when native binary not built
  GLIMPSE_BACKEND=chromium to force, GLIMPSE_BACKEND=native to
  require native. statusItem() now works on linux-chromium too.

- src/follow-cursor-support.mjs: reports X11 as supported when
  Chromium backend is active.

- test/test-chromium.mjs: 15 test suites, 36 assertions covering
  every feature.

- glimpse-chromium.md: design doc with architecture, protocol
  mapping, and implementation notes.
@HazAT
Copy link
Owner

HazAT commented Mar 20, 2026

thx

@HazAT HazAT merged commit b704dec into HazAT:main Mar 20, 2026
HazAT added a commit that referenced this pull request Mar 20, 2026
Add changelog entry for the two community contributions in this release:

- PR #8 (@hjanuschka): Chromium CDP backend for Linux — a zero-compile
  alternative to WebKitGTK that auto-falls back to system Chromium via
  remote-debugging-pipe. Adds follow-cursor on X11, system tray support,
  and external link opening on Linux.

- PR #7 (@Whamp): Linux CLI fixes for negative number arg parsing and
  platform-gated options that caused startup failures.

Update README to document the Chromium CDP backend: platform table,
build instructions (Option A native / Option B zero-compile), expanded
platform notes matrix splitting Linux native vs Chromium columns,
GLIMPSE_BACKEND env var, and architecture listing.
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.

2 participants