Consume Ctrl+click after opening a URL so it isn't opened twice - #1104
Open
aaronmhmr wants to merge 1 commit into
Open
Consume Ctrl+click after opening a URL so it isn't opened twice#1104aaronmhmr wants to merge 1 commit into
aaronmhmr wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On a Ctrl+click on a URL,
on_buttonpressopens the link but never returnsTrue, so GTK keeps propagating thebutton-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
Trueonce 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_LEFTbranch — the two paths that callopen_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:With this change, the mouse-reporting case drops back to a single launch.
Fixes #1103
🤖 Generated with Claude Code