Skip to content

feat(term): add a setting to yield right-click to the terminal app - #3609

Open
smcho-kr wants to merge 1 commit into
wavetermdev:mainfrom
smcho-kr:feat/term-rightclickmenu
Open

smcho-kr wants to merge 1 commit into
wavetermdev:mainfrom
smcho-kr:feat/term-rightclickmenu

Conversation

@smcho-kr

Copy link
Copy Markdown

Problem

Full-screen terminal apps that enable mouse tracking (herdr, tmux, btop, lazygit, …) draw their own context menu on right-click, but Wave's terminal context menu opens on top of it. The app's menu is there — it is just covered, so it is unreachable with the mouse.

Fix

Add a term:rightclickmenu setting with three modes:

value behaviour
auto (default) yield the right-click to the terminal app while it reports a mouse tracking mode other than none, otherwise show Wave's menu
wave always show Wave's menu
app always yield to the terminal app

term:rightclickmenu can be set globally or per block (block metadata wins).

The contextmenu handler still always calls preventDefault() / stopPropagation(), so Chromium's text menu never appears over the terminal — the only thing that changes is whether Wave's own menu is shown.

Default value

auto changes existing behaviour for users who run a mouse-tracking TUI (they stop getting Wave's menu on right-click). That seemed like the right default — the alternative is a user-visible regression for exactly the people this is meant to help — but wave is a one-line change if you would rather keep today's behaviour and make the new mode opt-in.

Files

  • frontend/app/view/term/termutil.ts — shouldShowWaveContextMenu(setting, mouseTrackingMode)
  • frontend/app/view/term/term.tsx — resolve the setting and consult terminal.modes.mouseTrackingMode
  • pkg/wconfig/metaconsts.go, pkg/wconfig/settingsconfig.go, schema/settings.json, frontend/types/gotypes.d.ts — the setting key
  • frontend/app/view/term/termutil-rightclick.test.ts — 4 tests covering auto/wave/app and unknown values

Testing

npx vitest run frontend/app/view/term/termutil-rightclick.test.ts
→ Test Files 1 passed, Tests 4 passed

Verified manually with herdr (ui.mouse_capture): in auto the TUI menu opens, in wave Wave's menu opens.

Applications that enable mouse tracking (herdr, tmux, btop, ...) draw
their own context menu on right-click, but Wave's menu opened on top of
it, so the app's menu was unreachable.

Add `term:rightclickmenu` (auto | wave | app, default auto). In auto mode
the right-click is left to the app while the terminal reports a mouse
tracking mode other than none; otherwise Wave keeps its menu. The event
is always prevented and stopped, so Chromium's text menu still cannot
appear over the terminal.

Unit tests cover the auto/wave/app resolution in termutil.test.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes add the term:rightclickmenu setting with auto, wave, and app values. The terminal view resolves the setting from block metadata or terminal settings, then applies it with the terminal’s mouse-tracking mode to decide whether to show Wave’s context menu. Tests cover explicit modes, automatic mode, and unknown settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Minimal · up to 90a9b

This adds a term:rightclickmenu setting (auto, wave, app) that lets mouse-tracking terminal apps keep their own right-click menus. The default auto mode intentionally changes behavior for those apps, and wave restores the old behavior. No concrete merge-blocking risk was found, and the new helper has unit tests.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a new terminal setting that lets right-click go to the terminal app. The changeset adds the term:rightclickmenu setting, the shouldShowWaveContextMenu helper, and the …
Description check Passed The description explains the problem (Wave's context menu covers menus drawn by mouse-tracking terminal apps), the new three-mode setting, the default behavior change, the files touched, and the tests…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a new terminal setting that lets right-click go to the terminal app. The changeset adds the term:rightclickmenu setting, the shouldShowWaveContextMenu helper, and the matching config and schema entries. The title is specific and matches the code changes.

Full details: Description check

Explanation

The description explains the problem (Wave's context menu covers menus drawn by mouse-tracking terminal apps), the new three-mode setting, the default behavior change, the files touched, and the tests run. It matches the changeset closely.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Biome (2.6.5)

frontend/types/gotypes.d.ts

File contains syntax errors that prevent linting: Line 1881: Expected a property, or a signature but instead found '#'.; Line 1881: Expected an expression, or an assignment but instead found ':'.; Line 1881: Expected an expression but instead found ']'.; Line 2194: Expected a statement but instead found '}'.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 81ac6dd8-20bb-48cd-8c04-9b2a52254f52
Commits

Reviewing files that changed from the base of the PR and between 9f1c967 and 90a9b61.

Files selected for processing: 7

  • frontend/app/view/term/term.tsx
  • frontend/app/view/term/termutil-rightclick.test.ts
  • frontend/app/view/term/termutil.ts
  • frontend/types/gotypes.d.ts
  • pkg/wconfig/metaconsts.go
  • pkg/wconfig/settingsconfig.go
  • schema/settings.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

This branch has not been deployed

No deployments
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