Skip to content

Consume Ctrl+click after opening a URL so it isn't opened twice - #1104

Open
aaronmhmr wants to merge 1 commit into
gnome-terminator:masterfrom
aaronmhmr:fix/consume-ctrl-click-url-open
Open

Consume Ctrl+click after opening a URL so it isn't opened twice#1104
aaronmhmr wants to merge 1 commit into
gnome-terminator:masterfrom
aaronmhmr:fix/consume-ctrl-click-url-open

Conversation

@aaronmhmr

Copy link
Copy Markdown

What

On a Ctrl+click on a URL, on_buttonpress opens the link but never returns True, so GTK keeps propagating the button-press-event. With mouse reporting enabled, VTE forwards the same click to the foreground application. TUIs that treat Ctrl+click as "open link" (e.g. Claude Code, and comparable vim/tmux mouse setups) then open the same URL a second time, producing two browser tabs from a single click.

This returns True once a URL has actually been opened, so Terminator consumes the click it just handled. Clicks that don't hit a URL still fall through unchanged (selection, etc. are unaffected).

Why it happens

terminatorlib/terminal.py, on_buttonpress, MOUSEBUTTON_LEFT branch — the two paths that call open_url() fall through without stopping the event, so the click reaches both Terminator's URL handler and the application underneath.

Evidence

Pointing the default http(s) handler at a logging wrapper, a single Ctrl+click:

  • in a normal shell (no mouse reporting): 1 browser launch ✅
  • inside a mouse-reporting TUI: 2 launches ~0.5s apart — one from Terminator, one from the app ❌

With this change, the mouse-reporting case drops back to a single launch.

Fixes #1103

🤖 Generated with Claude Code

on_buttonpress opened the URL on Ctrl+click but never returned True, so
GTK kept propagating the button-press event. With mouse reporting enabled,
VTE then forwards the same click to the foreground application; TUIs that
treat Ctrl+click as "open link" open the URL a second time, producing two
browser tabs from a single click.

Return True once a URL has actually been opened so Terminator consumes the
click it just handled. Clicks that don't hit a URL still fall through
unchanged.

Fixes gnome-terminator#1103

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

Ctrl+click opens URL twice when the foreground application also handles the click (mouse reporting)

1 participant