Skip to content

fix: leave right-click to programs that report the mouse - #39

Merged
LukeGus merged 1 commit into
Termix-SSH:dev-1.1.2from
DL6ER:fix/right-click-mouse-tracking
Oct 29, 2026
Merged

LukeGus merged 1 commit into
Termix-SSH:dev-1.1.2from
DL6ER:fix/right-click-mouse-tracking

Conversation

@DL6ER

@DL6ER DL6ER commented Oct 23, 2026

Copy link
Copy Markdown

What

With tmux mouse mode on (or any program that turns on mouse reporting), a right-click opens the program's own menu, for example the tmux pane and status bar menus. Termix handled the same click as well:

  • With "Enable right-click copy/paste" on (the default), it pasted the clipboard. In a tmux menu the pasted characters are taken as shortcuts: a m marks the pane, n renames, X kills the window or pane. The menu also closed on the first character that did not match.
  • With it off, the browser context menu opened on top of the tmux menu.

So neither setting gave a usable tmux menu.

This makes the right button belong to the program while it reports the mouse (terminal.modes.mouseTrackingMode !== "none"): nothing is pasted and the browser menu is suppressed. Holding Shift keeps the previous behavior (paste or copy with the setting on, native menu with it off), the same way Shift forces text selection while a program reports the mouse.

Behavior without mouse reporting is unchanged, including Ctrl+right-click for the file manager.

Changes

  • terminal-clipboard-actions.ts: resolveTerminalContextMenuAction() takes mouseTracking and shiftKey and returns a new "app" action in that case.
  • Terminal.tsx and terminal-clipboard.ts (used by the local terminal) pass the two values and only preventDefault() on "app".
  • Tests for the new action, with and without Shift and with the preference on and off, and for the handler. The handler test fails without the change.

Tradeoff

Anyone who right-clicks to paste inside tmux with mouse on, or in a mouse-reporting TUI, now needs Shift+right-click (or Ctrl+Shift+V). I think the program receiving the click is the better default there, since it already got it, but I can put this behind a setting if you prefer.

Testing

  • vitest for terminal-clipboard and terminal-clipboard-actions: passing. tsc -p . and prettier --check are clean. I ran them on Node 22, because the jsdom based test files do not start on Node 20 here.
  • Checked by hand with the built bundle, on tmux 3.5a: a right-click on a pane and on a window name opens only the tmux menu, nothing is pasted and no browser menu appears.
  • Not checked: macOS, Safari, other tmux versions.
  • One thing I noticed while testing, outside this PR: the default tmux menu closes when the mouse moves after a short right-click, so it is hard to use. display-menu -O in the user's tmux.conf avoids that.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 17:39
@termix-triage-bot termix-triage-bot Bot moved this to Open PRs in Termix Roadmap Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

With tmux mouse mode on (or any program that enables mouse reporting),
a right-click opens the program's own menu. Termix additionally pasted
the clipboard into it, where single characters act as menu shortcuts, or,
with right-click copy/paste off, opened the browser context menu on top.

When mouse reporting is active the right-click now only goes to the
program. Holding Shift keeps the previous behavior, like it does for
selecting text.
@DL6ER
DL6ER force-pushed the fix/right-click-mouse-tracking branch from 8fd9c94 to 54463d8 Compare October 23, 2026 17:40
@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

Adds logic to defer right-click handling to the terminal program when mouse tracking is active, unless Shift is held. Includes tests and follows all repo conventions with no security or rule issues found.

Reviewed 54463d8. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

@LukeGus
LukeGus changed the base branch from main to dev-1.1.2 October 29, 2026 18:15
@LukeGus
LukeGus merged commit f0d4979 into Termix-SSH:dev-1.1.2 Oct 29, 2026
2 checks 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.

3 participants