Skip to content

Configurable right click behavior - #8254

Merged
mitchellh merged 2 commits into
ghostty-org:mainfrom
lujobi:feature/right-click-behavior
Aug 19, 2025
Merged

mitchellh merged 2 commits into
ghostty-org:mainfrom
lujobi:feature/right-click-behavior

Conversation

@lujobi

@lujobi lujobi commented Aug 15, 2025 •

Copy link
Copy Markdown

This MR addresses #4404 following the approach suggested here. Implementing the behavior known e.g. from Putty or Windows Terminal.

The following configuration values for right-click-action are provided:

  • context-menu - Show the context menu.
  • paste - Paste the contents of the clipboard.
  • copy - Copy the selected text to the clipboard.
  • copy-and-paste - Copy the selected text to the clipboard, paste if nothing is selected.
  • ignore - Do nothing, ignore the right-click.

I followed #5935 for getting an idea on where to start. I hope this to be a temporary solution until "bindable mouse bindings" are introduced.

This is my first time writing Zig code, so I am happy to incorporate any feedback.

Thank you all very much for your work!

@lujobi
lujobi requested a review from a team as a code owner August 15, 2025 21:39
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from cf1ecd9 to 92abcd6 Compare August 16, 2025 07:43

@pluiedev pluiedev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One small suggestion to the docs

Comment thread src/config/Config.zig Outdated
@lujobi
lujobi force-pushed the feature/right-click-behavior branch 2 times, most recently from 3406265 to 9ab67b3 Compare August 17, 2025 10:53
@lujobi
lujobi requested a review from pluiedev August 17, 2025 10:54
Comment thread src/config/Config.zig Outdated
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from 9ab67b3 to 4de6b3d Compare August 17, 2025 10:59
@lujobi
lujobi requested a review from 00-kat August 17, 2025 11:21
Comment thread src/Surface.zig Outdated
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from 4de6b3d to 1894ff8 Compare August 17, 2025 11:55
@lujobi
lujobi requested a review from 00-kat August 17, 2025 11:56
Comment thread src/Surface.zig Outdated
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from 1894ff8 to 1785aee Compare August 17, 2025 12:02
@pluiedev pluiedev linked an issue Aug 18, 2025 that may be closed by this pull request
@lujobi

lujobi commented Aug 19, 2025

Copy link
Copy Markdown
Author

@pluiedev would you mind taking another look the requested changes? Thank you!

@pluiedev pluiedev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The rest looks good, just some code nitpicks

Comment thread src/Surface.zig Outdated
Comment thread src/Surface.zig Outdated
Comment thread src/Surface.zig Outdated
Comment thread src/Surface.zig Outdated
Comment thread src/Surface.zig Outdated
Comment thread src/Surface.zig Outdated
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from bf1094b to 44fec7e Compare August 19, 2025 19:28
@lujobi
lujobi force-pushed the feature/right-click-behavior branch from 44fec7e to 54b7e18 Compare August 19, 2025 19:30

@pluiedev pluiedev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good pending CI

@mitchellh mitchellh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, looks great.

@mitchellh
mitchellh merged commit 5745f50 into ghostty-org:main Aug 19, 2025
@github-actions github-actions Bot added this to the 1.2.0 milestone Aug 19, 2025
@anaisbetts

Copy link
Copy Markdown

I spent an evening vibe coding QuickEdit only to discover that it's already here, omg thank you!

mitchellh added a commit that referenced this pull request Apr 27, 2026
This PR addresses
#12108 implemented
similarly to #8254 to allow
middle click + TrackPoint scrolling on MacOS. `primary-paste` naming
comes from `gtk_enable_primary_paste`.

The following configuration values for `middle-click-action` are
provided:
- `primary-paste` - Paste from the selection (or system) clipboard per
`copy-on-select`.
- `ignore` - Do nothing, ignore the middle click.

Tested locally on macOS with Zig 0.15.2 using `zig build
-Doptimize=ReleaseFast`.

Thank you!
christmic pushed a commit to christmic/Sylvander that referenced this pull request Aug 12, 2026
This PR addresses
ghostty-org/ghostty#12108 implemented
similarly to ghostty-org/ghostty#8254 to allow
middle click + TrackPoint scrolling on MacOS. `primary-paste` naming
comes from `gtk_enable_primary_paste`.

The following configuration values for `middle-click-action` are
provided:
- `primary-paste` - Paste from the selection (or system) clipboard per
`copy-on-select`.
- `ignore` - Do nothing, ignore the middle click.

Tested locally on macOS with Zig 0.15.2 using `zig build
-Doptimize=ReleaseFast`.

Thank you!
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.

Introduce option to right click to copy

5 participants