mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Add alt keybindings for ctrl+ins = Copy and shift+ins = Paste (#2870)
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](https://github.com/NixOS/nixpkgs/issues/137698#issuecomment-2404192700); with the default `ctrl+shift+c` keybinding for copy this is basically impossible (because that binding only applies to terminals).
This commit is contained in:
@ -2083,6 +2083,20 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
||||
.{ .key = .{ .translated = .v }, .mods = mods },
|
||||
.{ .paste_from_clipboard = {} },
|
||||
);
|
||||
// On non-MacOS desktop envs (Windows, KDE, Gnome, Xfce), ctrl+insert is an
|
||||
// alt keybinding for Copy and shift+ins is an alt keybinding for Paste
|
||||
if (!builtin.target.isDarwin()) {
|
||||
try result.keybind.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .translated = .insert }, .mods = .{ .ctrl = true } },
|
||||
.{ .copy_to_clipboard = {} },
|
||||
);
|
||||
try result.keybind.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .translated = .insert }, .mods = .{ .shift = true } },
|
||||
.{ .paste_from_clipboard = {} },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Increase font size mapping for keyboards with dedicated plus keys (like german)
|
||||
|
Reference in New Issue
Block a user