Skip to content

fix: preview browser launch to reuse existing tabs#10

Merged
vihu merged 2 commits into
mainfrom
rg/browser-reuse
May 13, 2026
Merged

fix: preview browser launch to reuse existing tabs#10
vihu merged 2 commits into
mainfrom
rg/browser-reuse

Conversation

@vihu

@vihu vihu commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

This PR replaces Penview’s generic explicit-browser launch path with a small platform-aware launcher so :PenviewStart opens the preview in an existing browser instance/tab where possible, instead of spawning a new browser window or failing on paths with spaces.

Changes

  • Add rust/penview/src/browser.rs for browser launch handling.
  • Use /usr/bin/open -a on macOS.
  • Add --new-tab for known Unix browser families.
  • Preserve explicit user browser args like profiles or flatpak commands.
  • Preserve WSL/Windows browser executable paths with spaces, e.g. Zen Browser.
  • URL-encode the preview path query parameter.
  • Report browser launch failures to stderr instead of crashing the server.
  • Add unit tests for browser command construction.

vihu added 2 commits May 13, 2026 17:44
Add platform-specific browser launching so explicit browser opens reuse
existing browser instances where possible. Use `open -a <browser> <url>`
on macOS and add `--new-tab` for known Unix browsers.

Also report browser launch failures without crashing the preview server
and URL-encode the opened preview path.
@vihu vihu merged commit a98ef49 into main May 13, 2026
1 check passed
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