8000 feat(links): route BROWSER through wmux by Mattheinrichs · Pull Request #340 · amirlehmam/wmux · GitHub
[go: up one dir, main page]

Skip to content

feat(links): route BROWSER through wmux - #340

Merged
amirlehmam merged 7 commits into
amirlehmam:masterfrom
Mattheinrichs:links-browser-env
Oct 24, 2026
Merged

amirlehmam merged 7 commits into
amirlehmam:masterfrom
Mattheinrichs:links-browser-env

Conversation

@Mattheinrichs
@Mattheinrichs Mattheinrichs commented Oct 23, 2026 •
Copy link
Copy Markdown
Contributor

What

Closes #339.

Routes links opened by a CLI inside a WSL pane through wmux's existing link policy. Today OpenCode v2 captures the mouse and opens plain clicks itself with open; on WSL that reaches PowerShell and the system browser, so the panel only has Ctrl+click. Claude/Codex panes and shell output already open in the panel.

  • wmux open <url> — new CLI verb, sends link.open over the pipe and calls the renderer's openInWmuxBrowser(). It does not use wmux browser open: that resolves the caller's agent-bound browser (Concurrent agents share a single browser window, causing interference #62) and waits for CDP navigation. It returns after dispatch.
  • link.open — v2 bridge method. The URL is JSON-encoded into the executeJavaScript expression, and the renderer refuses anything but http(s).
  • wmux-open-url — a $BROWSER shim in cli-bin. PtyManager sets BROWSER=wmux-open-url for WSL panes only and adds BROWSER/u to WSLENV. The value is a bare name because BROWSER parsers split on whitespace and the install path can contain spaces. If wmux is unreachable, the shim hands the URL to wslview/explorer.exe instead of leaving a dead click.
  • Destination still follows Settings → Browser → Open links in the system browser. Native Windows panes keep whatever BROWSER they had; the shim is POSIX-only.

This is deliberately not "mouse": false in OpenCode: OpenCode stays on the alternate screen and does not scroll its transcript on arrows, so that would break wheel/touch (#245/#267). Mouse capture, wheelForward and touchPanGain are untouched. #280's plain-click rule is untouched too; the fix is to route the app's own opener.

Codex gets the behaviour immediately (its Rust opener honours $BROWSER). OpenCode needs the paired one-file change: anomalyco/opencode#58526.

Type of change

  • New feature
  • Bug fix
  • Refactor / code improvement
  • Documentation

Tests

npx vitest run tests/unit/open-link.test.ts tests/unit/link-open-bridge.test.ts \
  tests/unit/cli-open.test.ts tests/unit/browser-env.test.ts \
  tests/unit/cli-bin-shims.test.ts tests/unit/terminal-links.test.ts
# 44 passed, 4 skipped
npm run typecheck
npm run build:main

New coverage: renderer URL gate and delegation, JSON escaping of the bridge URL, wmux open argument rules, WSL-only BROWSER selection and WSLENV entry, and the shim forwarding open <url> to the CLI.

The live Windows/WSL matrix (wheel, touch, Codex and patched OpenCode clicks, both destination settings) is not runnable in this Linux container; it needs a manual pass before merge.

@amirlehmam
amirlehmam merged commit 05655c3 into amirlehmam:master Oct 24, 2026
amirlehmam added a commit that referenced this pull request Oct 24, 2026
The checked-in CLI copy lacked the new `wmux open` verb, which fails the
release build's verify:resources step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

Links: route OpenCode's own link clicks into the wmux panel

2 participants

0