Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alt keybindings for ctrl+ins = Copy and shift+ins = Paste #2870

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

deftdawg
Copy link
Contributor

@deftdawg deftdawg commented Dec 2, 2024

On non-MacOS desktop environments (Windows, Gnome, KDE, Xfce, VS Code, ...), ctrl+ins and shift+ins are system-wide alternate keybindings (except for terminals) for Copy and Paste respectively. This PR explicitly defines them as such in Ghostty's default keybindings.

Using ctrl+ins as an alt-keybinding for Copy allows static/context-unaware remapping of Copy to cmd+c for Linux systems using Mac keyboards via keyd; with the default ctrl+shift+c keybinding for copy this is basically impossible (because that binding only applies to terminals).

@deftdawg
Copy link
Contributor Author

deftdawg commented Dec 6, 2024

I hereby grant ghostty the right to use the code in this PR under the MIT license, in case you choose to merge it. 😄

@deftdawg
Copy link
Contributor Author

deftdawg commented Jan 1, 2025

The sibling PR to this was merged into Konsole today. Happy New Year 🥂

@mitchellh mitchellh enabled auto-merge January 2, 2025 15:16
@mitchellh mitchellh disabled auto-merge January 2, 2025 15:57
@mitchellh mitchellh enabled auto-merge January 2, 2025 15:57
@mitchellh mitchellh disabled auto-merge January 2, 2025 15:57
@mitchellh mitchellh merged commit 80c3833 into ghostty-org:main Jan 2, 2025
17 checks passed
@github-actions github-actions bot added this to the 1.0.2 milestone Jan 2, 2025
@rockorager
Copy link
Collaborator

This PR has somehow broken toasts when copying with ctrl+shift+c. Toasts still display if I use the ctrl+ins bind. Reverting this commit does fix the issue, but I cannot for the life of me see how.

@rockorager
Copy link
Collaborator

Another datapoint: adding keybind = ctrl+insert=unbind also fixes this.

Adding any other keybind which does the copy_to_clipboard action breaks the original bind. The underlying text is copied though

@rockorager
Copy link
Collaborator

Oh I see the issue. We only set a single accelerator for copy_to_clipboard

@deftdawg
Copy link
Contributor Author

deftdawg commented Jan 5, 2025

Is there a function preferable to set.put that would be better or is this a data structure thing? (Apologies if this a dumb question)

@mitchellh
Copy link
Contributor

Oh I see the issue. We only set a single accelerator for copy_to_clipboard

The real bug is we should probably trigger the toast for any of the bindings. We should also probably put this binding before so that for menus we use the more traditional one

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