Add a keybinding for toggling mouse capture at runtime (%)#5798
Open
stefanhaller wants to merge 1 commit into
Open
Add a keybinding for toggling mouse capture at runtime (%)#5798stefanhaller wants to merge 1 commit into
stefanhaller wants to merge 1 commit into
Conversation
Some terminals provide a modifier key that bypasses mouse capture so that text can be selected with the mouse and copied to the clipboard (option in iTerm, shift in Ghostty), but others don't (e.g. the terminals built into VS Code and Zed). In those, selecting text requires setting gui.mouseEvents to false in the config file and back again afterwards, which is inconvenient. Add a global keybinding (% by default) that toggles mouse capture on the fly. Like the whitespace toggle, it flips the in-memory config value, so the toggled state lasts until the config file is changed and reloaded. The key needs to be free in every panel, and % is; as a plain rune it also arrives reliably in every terminal on all platforms, and it can't fire while typing in a text prompt, since editors consume plain runes. An alt-based binding would have been more mnemonic, but doesn't reach lazygit in the built-in terminals of VS Code and Zed on macOS (the very terminals that need this feature) unless the option key is configured to act as meta; and a ctrl-based binding would burn one of the few remaining free ctrl keys, which are better saved for future features that get used more frequently. Co-Authored-By: Claude Fable 5 <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.
Some terminals provide a modifier key that bypasses mouse capture so that text can be selected with the mouse and copied to the clipboard (option in iTerm, shift in Ghostty), but others don't (e.g. the terminals built into VS Code and Zed). In those, selecting text requires setting gui.mouseEvents to false in the config file and back again afterwards, which is inconvenient.
Add a global keybinding (
%by default) that toggles mouse capture on the fly. Like the whitespace toggle, it flips the in-memory config value, so the toggled state lasts until the config file is changed and reloaded.