diff --git a/include/ghostty.h b/include/ghostty.h index 941223943..950f5ef80 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -292,6 +292,11 @@ typedef enum { GHOSTTY_KEY_AUDIO_VOLUME_MUTE, GHOSTTY_KEY_AUDIO_VOLUME_UP, GHOSTTY_KEY_WAKE_UP, + + // "Legacy, Non-standard, and Special Keys" § 3.7 + GHOSTTY_KEY_COPY, + GHOSTTY_KEY_CUT, + GHOSTTY_KEY_PASTE, } ghostty_input_key_e; typedef struct { diff --git a/src/apprt/gtk/key.zig b/src/apprt/gtk/key.zig index 3dcfaed98..fc3296366 100644 --- a/src/apprt/gtk/key.zig +++ b/src/apprt/gtk/key.zig @@ -388,6 +388,10 @@ const keymap: []const RawEntry = &.{ .{ gdk.KEY_KP_Delete, .numpad_delete }, .{ gdk.KEY_KP_Begin, .numpad_begin }, + .{ gdk.KEY_Copy, .copy }, + .{ gdk.KEY_Cut, .cut }, + .{ gdk.KEY_Paste, .paste }, + .{ gdk.KEY_Shift_L, .shift_left }, .{ gdk.KEY_Control_L, .control_left }, .{ gdk.KEY_Alt_L, .alt_left }, diff --git a/src/input/key.zig b/src/input/key.zig index 9dad37d78..28aa3ccf4 100644 --- a/src/input/key.zig +++ b/src/input/key.zig @@ -454,6 +454,11 @@ pub const Key = enum(c_int) { audio_volume_up, wake_up, + // "Legacy, Non-standard, and Special Keys" § 3.7 + copy, + cut, + paste, + /// Converts an ASCII character to a key, if possible. This returns /// null if the character is unknown. /// @@ -797,6 +802,9 @@ pub const Key = enum(c_int) { .audio_volume_up, .wake_up, .help, + .copy, + .cut, + .paste, => null, .unidentified, diff --git a/src/input/keycodes.zig b/src/input/keycodes.zig index b4004088e..a85f36d31 100644 --- a/src/input/keycodes.zig +++ b/src/input/keycodes.zig @@ -130,6 +130,9 @@ const code_to_key = code_to_key: { .{ "PageUp", .page_up }, .{ "Delete", .delete }, .{ "End", .end }, + .{ "Copy", .copy }, + .{ "Cut", .cut }, + .{ "Paste", .paste }, .{ "PageDown", .page_down }, .{ "ArrowRight", .arrow_right }, .{ "ArrowLeft", .arrow_left },