diff --git a/include/ghostty.h b/include/ghostty.h index 9409fa7c6..600396a84 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -104,9 +104,28 @@ typedef enum { } ghostty_input_action_e; typedef enum { - GHOSTTY_KEY_INVALID, + GHOSTTY_KEY_UNIDENTIFIED, - // a-z + // "Writing System Keys" § 3.1.1 + GHOSTTY_KEY_BACKQUOTE, + GHOSTTY_KEY_BACKSLASH, + GHOSTTY_KEY_BRACKET_LEFT, + GHOSTTY_KEY_BRACKET_RIGHT, + GHOSTTY_KEY_COMMA, + GHOSTTY_KEY_DIGIT_0, + GHOSTTY_KEY_DIGIT_1, + GHOSTTY_KEY_DIGIT_2, + GHOSTTY_KEY_DIGIT_3, + GHOSTTY_KEY_DIGIT_4, + GHOSTTY_KEY_DIGIT_5, + GHOSTTY_KEY_DIGIT_6, + GHOSTTY_KEY_DIGIT_7, + GHOSTTY_KEY_DIGIT_8, + GHOSTTY_KEY_DIGIT_9, + GHOSTTY_KEY_EQUAL, + GHOSTTY_KEY_INTL_BACKSLASH, + GHOSTTY_KEY_INTL_RO, + GHOSTTY_KEY_INTL_YEN, GHOSTTY_KEY_A, GHOSTTY_KEY_B, GHOSTTY_KEY_C, @@ -133,56 +152,90 @@ typedef enum { GHOSTTY_KEY_X, GHOSTTY_KEY_Y, GHOSTTY_KEY_Z, - - // numbers - GHOSTTY_KEY_ZERO, - GHOSTTY_KEY_ONE, - GHOSTTY_KEY_TWO, - GHOSTTY_KEY_THREE, - GHOSTTY_KEY_FOUR, - GHOSTTY_KEY_FIVE, - GHOSTTY_KEY_SIX, - GHOSTTY_KEY_SEVEN, - GHOSTTY_KEY_EIGHT, - GHOSTTY_KEY_NINE, - - // puncuation - GHOSTTY_KEY_SEMICOLON, - GHOSTTY_KEY_SPACE, - GHOSTTY_KEY_APOSTROPHE, - GHOSTTY_KEY_COMMA, - GHOSTTY_KEY_GRAVE_ACCENT, // ` - GHOSTTY_KEY_PERIOD, - GHOSTTY_KEY_SLASH, GHOSTTY_KEY_MINUS, - GHOSTTY_KEY_PLUS, - GHOSTTY_KEY_EQUAL, - GHOSTTY_KEY_LEFT_BRACKET, // [ - GHOSTTY_KEY_RIGHT_BRACKET, // ] - GHOSTTY_KEY_BACKSLASH, // \ + GHOSTTY_KEY_PERIOD, + GHOSTTY_KEY_QUOTE, + GHOSTTY_KEY_SEMICOLON, + GHOSTTY_KEY_SLASH, - // control - GHOSTTY_KEY_UP, - GHOSTTY_KEY_DOWN, - GHOSTTY_KEY_RIGHT, - GHOSTTY_KEY_LEFT, - GHOSTTY_KEY_HOME, - GHOSTTY_KEY_END, - GHOSTTY_KEY_INSERT, - GHOSTTY_KEY_DELETE, - GHOSTTY_KEY_CAPS_LOCK, - GHOSTTY_KEY_SCROLL_LOCK, - GHOSTTY_KEY_NUM_LOCK, - GHOSTTY_KEY_PAGE_UP, - GHOSTTY_KEY_PAGE_DOWN, - GHOSTTY_KEY_ESCAPE, - GHOSTTY_KEY_ENTER, - GHOSTTY_KEY_TAB, + // "Functional Keys" § 3.1.2 + GHOSTTY_KEY_ALT_LEFT, + GHOSTTY_KEY_ALT_RIGHT, GHOSTTY_KEY_BACKSPACE, - GHOSTTY_KEY_PRINT_SCREEN, - GHOSTTY_KEY_PAUSE, + GHOSTTY_KEY_CAPS_LOCK, + GHOSTTY_KEY_CONTEXT_MENU, + GHOSTTY_KEY_CONTROL_LEFT, + GHOSTTY_KEY_CONTROL_RIGHT, + GHOSTTY_KEY_ENTER, + GHOSTTY_KEY_META_LEFT, + GHOSTTY_KEY_META_RIGHT, + GHOSTTY_KEY_SHIFT_LEFT, + GHOSTTY_KEY_SHIFT_RIGHT, + GHOSTTY_KEY_SPACE, + GHOSTTY_KEY_TAB, + GHOSTTY_KEY_CONVERT, + GHOSTTY_KEY_KANA_MODE, + GHOSTTY_KEY_NON_CONVERT, - // function keys + // "Control Pad Section" § 3.2 + GHOSTTY_KEY_DELETE, + GHOSTTY_KEY_END, + GHOSTTY_KEY_HELP, + GHOSTTY_KEY_HOME, + GHOSTTY_KEY_INSERT, + GHOSTTY_KEY_PAGE_DOWN, + GHOSTTY_KEY_PAGE_UP, + + // "Arrow Pad Section" § 3.3 + GHOSTTY_KEY_ARROW_DOWN, + GHOSTTY_KEY_ARROW_LEFT, + GHOSTTY_KEY_ARROW_RIGHT, + GHOSTTY_KEY_ARROW_UP, + + // "Numpad Section" § 3.4 + GHOSTTY_KEY_NUM_LOCK, + GHOSTTY_KEY_NUMPAD_0, + GHOSTTY_KEY_NUMPAD_1, + GHOSTTY_KEY_NUMPAD_2, + GHOSTTY_KEY_NUMPAD_3, + GHOSTTY_KEY_NUMPAD_4, + GHOSTTY_KEY_NUMPAD_5, + GHOSTTY_KEY_NUMPAD_6, + GHOSTTY_KEY_NUMPAD_7, + GHOSTTY_KEY_NUMPAD_8, + GHOSTTY_KEY_NUMPAD_9, + GHOSTTY_KEY_NUMPAD_ADD, + GHOSTTY_KEY_NUMPAD_BACKSPACE, + GHOSTTY_KEY_NUMPAD_CLEAR, + GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY, + GHOSTTY_KEY_NUMPAD_COMMA, + GHOSTTY_KEY_NUMPAD_DECIMAL, + GHOSTTY_KEY_NUMPAD_DIVIDE, + GHOSTTY_KEY_NUMPAD_ENTER, + GHOSTTY_KEY_NUMPAD_EQUAL, + GHOSTTY_KEY_NUMPAD_MEMORY_ADD, + GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR, + GHOSTTY_KEY_NUMPAD_MEMORY_RECALL, + GHOSTTY_KEY_NUMPAD_MEMORY_STORE, + GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT, + GHOSTTY_KEY_NUMPAD_MULTIPLY, + GHOSTTY_KEY_NUMPAD_PAREN_LEFT, + GHOSTTY_KEY_NUMPAD_PAREN_RIGHT, + GHOSTTY_KEY_NUMPAD_SUBTRACT, + GHOSTTY_KEY_NUMPAD_UP, + GHOSTTY_KEY_NUMPAD_DOWN, + GHOSTTY_KEY_NUMPAD_RIGHT, + GHOSTTY_KEY_NUMPAD_LEFT, + GHOSTTY_KEY_NUMPAD_BEGIN, + GHOSTTY_KEY_NUMPAD_HOME, + GHOSTTY_KEY_NUMPAD_END, + GHOSTTY_KEY_NUMPAD_INSERT, + GHOSTTY_KEY_NUMPAD_DELETE, + GHOSTTY_KEY_NUMPAD_PAGE_UP, + GHOSTTY_KEY_NUMPAD_PAGE_DOWN, + + // "Function Section" § 3.5 + GHOSTTY_KEY_ESCAPE, GHOSTTY_KEY_F1, GHOSTTY_KEY_F2, GHOSTTY_KEY_F3, @@ -208,50 +261,35 @@ typedef enum { GHOSTTY_KEY_F23, GHOSTTY_KEY_F24, GHOSTTY_KEY_F25, + GHOSTTY_KEY_FN, + GHOSTTY_KEY_FN_LOCK, + GHOSTTY_KEY_PRINT_SCREEN, + GHOSTTY_KEY_SCROLL_LOCK, + GHOSTTY_KEY_PAUSE, - // keypad - GHOSTTY_KEY_KP_0, - GHOSTTY_KEY_KP_1, - GHOSTTY_KEY_KP_2, - GHOSTTY_KEY_KP_3, - GHOSTTY_KEY_KP_4, - GHOSTTY_KEY_KP_5, - GHOSTTY_KEY_KP_6, - GHOSTTY_KEY_KP_7, - GHOSTTY_KEY_KP_8, - GHOSTTY_KEY_KP_9, - GHOSTTY_KEY_KP_DECIMAL, - GHOSTTY_KEY_KP_DIVIDE, - GHOSTTY_KEY_KP_MULTIPLY, - GHOSTTY_KEY_KP_SUBTRACT, - GHOSTTY_KEY_KP_ADD, - GHOSTTY_KEY_KP_ENTER, - GHOSTTY_KEY_KP_EQUAL, - GHOSTTY_KEY_KP_SEPARATOR, - GHOSTTY_KEY_KP_LEFT, - GHOSTTY_KEY_KP_RIGHT, - GHOSTTY_KEY_KP_UP, - GHOSTTY_KEY_KP_DOWN, - GHOSTTY_KEY_KP_PAGE_UP, - GHOSTTY_KEY_KP_PAGE_DOWN, - GHOSTTY_KEY_KP_HOME, - GHOSTTY_KEY_KP_END, - GHOSTTY_KEY_KP_INSERT, - GHOSTTY_KEY_KP_DELETE, - GHOSTTY_KEY_KP_BEGIN, - - // special keys - GHOSTTY_KEY_CONTEXT_MENU, - - // modifiers - GHOSTTY_KEY_LEFT_SHIFT, - GHOSTTY_KEY_LEFT_CONTROL, - GHOSTTY_KEY_LEFT_ALT, - GHOSTTY_KEY_LEFT_SUPER, - GHOSTTY_KEY_RIGHT_SHIFT, - GHOSTTY_KEY_RIGHT_CONTROL, - GHOSTTY_KEY_RIGHT_ALT, - GHOSTTY_KEY_RIGHT_SUPER, + // "Media Keys" § 3.6 + GHOSTTY_KEY_BROWSER_BACK, + GHOSTTY_KEY_BROWSER_FAVORITES, + GHOSTTY_KEY_BROWSER_FORWARD, + GHOSTTY_KEY_BROWSER_HOME, + GHOSTTY_KEY_BROWSER_REFRESH, + GHOSTTY_KEY_BROWSER_SEARCH, + GHOSTTY_KEY_BROWSER_STOP, + GHOSTTY_KEY_EJECT, + GHOSTTY_KEY_LAUNCH_APP_1, + GHOSTTY_KEY_LAUNCH_APP_2, + GHOSTTY_KEY_LAUNCH_MAIL, + GHOSTTY_KEY_MEDIA_PLAY_PAUSE, + GHOSTTY_KEY_MEDIA_SELECT, + GHOSTTY_KEY_MEDIA_STOP, + GHOSTTY_KEY_MEDIA_TRACK_NEXT, + GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS, + GHOSTTY_KEY_POWER, + GHOSTTY_KEY_SLEEP, + GHOSTTY_KEY_AUDIO_VOLUME_DOWN, + GHOSTTY_KEY_AUDIO_VOLUME_MUTE, + GHOSTTY_KEY_AUDIO_VOLUME_UP, + GHOSTTY_KEY_WAKE_UP, } ghostty_input_key_e; typedef struct { @@ -265,7 +303,6 @@ typedef struct { } ghostty_input_key_s; typedef enum { - GHOSTTY_TRIGGER_TRANSLATED, GHOSTTY_TRIGGER_PHYSICAL, GHOSTTY_TRIGGER_UNICODE, } ghostty_input_trigger_tag_e; diff --git a/macos/Sources/Ghostty/Ghostty.Input.swift b/macos/Sources/Ghostty/Ghostty.Input.swift index 0be579122..942ca5973 100644 --- a/macos/Sources/Ghostty/Ghostty.Input.swift +++ b/macos/Sources/Ghostty/Ghostty.Input.swift @@ -5,12 +5,6 @@ import GhosttyKit extension Ghostty { // MARK: Keyboard Shortcuts - /// Returns the SwiftUI KeyEquivalent for a given key. Note that not all keys known by - /// Ghostty have a macOS equivalent since macOS doesn't allow all keys as equivalents. - static func keyEquivalent(key: ghostty_input_key_e) -> KeyEquivalent? { - return Self.keyToEquivalent[key] - } - /// Return the key equivalent for the given trigger. /// /// Returns nil if the trigger doesn't have an equivalent KeyboardShortcut. This is possible @@ -22,16 +16,11 @@ extension Ghostty { static func keyboardShortcut(for trigger: ghostty_input_trigger_s) -> KeyboardShortcut? { let key: KeyEquivalent switch (trigger.tag) { - case GHOSTTY_TRIGGER_TRANSLATED: - if let v = Ghostty.keyEquivalent(key: trigger.key.translated) { - key = v - } else { - return nil - } - case GHOSTTY_TRIGGER_PHYSICAL: - if let v = Ghostty.keyEquivalent(key: trigger.key.physical) { - key = v + // Only functional keys can be converted to a KeyboardShortcut. Other physical + // mappings cannot because KeyboardShortcut in Swift is inherently layout-dependent. + if let equiv = Self.keyToEquivalent[trigger.key.physical] { + key = equiv } else { return nil } @@ -86,64 +75,11 @@ extension Ghostty { /// not all ghostty key enum values are represented here because not all of them can be /// mapped to a KeyEquivalent. static let keyToEquivalent: [ghostty_input_key_e : KeyEquivalent] = [ - // 0-9 - GHOSTTY_KEY_ZERO: "0", - GHOSTTY_KEY_ONE: "1", - GHOSTTY_KEY_TWO: "2", - GHOSTTY_KEY_THREE: "3", - GHOSTTY_KEY_FOUR: "4", - GHOSTTY_KEY_FIVE: "5", - GHOSTTY_KEY_SIX: "6", - GHOSTTY_KEY_SEVEN: "7", - GHOSTTY_KEY_EIGHT: "8", - GHOSTTY_KEY_NINE: "9", - - // a-z - GHOSTTY_KEY_A: "a", - GHOSTTY_KEY_B: "b", - GHOSTTY_KEY_C: "c", - GHOSTTY_KEY_D: "d", - GHOSTTY_KEY_E: "e", - GHOSTTY_KEY_F: "f", - GHOSTTY_KEY_G: "g", - GHOSTTY_KEY_H: "h", - GHOSTTY_KEY_I: "i", - GHOSTTY_KEY_J: "j", - GHOSTTY_KEY_K: "k", - GHOSTTY_KEY_L: "l", - GHOSTTY_KEY_M: "m", - GHOSTTY_KEY_N: "n", - GHOSTTY_KEY_O: "o", - GHOSTTY_KEY_P: "p", - GHOSTTY_KEY_Q: "q", - GHOSTTY_KEY_R: "r", - GHOSTTY_KEY_S: "s", - GHOSTTY_KEY_T: "t", - GHOSTTY_KEY_U: "u", - GHOSTTY_KEY_V: "v", - GHOSTTY_KEY_W: "w", - GHOSTTY_KEY_X: "x", - GHOSTTY_KEY_Y: "y", - GHOSTTY_KEY_Z: "z", - - // Symbols - GHOSTTY_KEY_APOSTROPHE: "'", - GHOSTTY_KEY_BACKSLASH: "\\", - GHOSTTY_KEY_COMMA: ",", - GHOSTTY_KEY_EQUAL: "=", - GHOSTTY_KEY_GRAVE_ACCENT: "`", - GHOSTTY_KEY_LEFT_BRACKET: "[", - GHOSTTY_KEY_MINUS: "-", - GHOSTTY_KEY_PERIOD: ".", - GHOSTTY_KEY_RIGHT_BRACKET: "]", - GHOSTTY_KEY_SEMICOLON: ";", - GHOSTTY_KEY_SLASH: "/", - // Function keys - GHOSTTY_KEY_UP: .upArrow, - GHOSTTY_KEY_DOWN: .downArrow, - GHOSTTY_KEY_LEFT: .leftArrow, - GHOSTTY_KEY_RIGHT: .rightArrow, + GHOSTTY_KEY_ARROW_UP: .upArrow, + GHOSTTY_KEY_ARROW_DOWN: .downArrow, + GHOSTTY_KEY_ARROW_LEFT: .leftArrow, + GHOSTTY_KEY_ARROW_RIGHT: .rightArrow, GHOSTTY_KEY_HOME: .home, GHOSTTY_KEY_END: .end, GHOSTTY_KEY_DELETE: .delete, @@ -153,104 +89,22 @@ extension Ghostty { GHOSTTY_KEY_ENTER: .return, GHOSTTY_KEY_TAB: .tab, GHOSTTY_KEY_BACKSPACE: .delete, - ] - - static let asciiToKey: [UInt8 : ghostty_input_key_e] = [ - // 0-9 - 0x30: GHOSTTY_KEY_ZERO, - 0x31: GHOSTTY_KEY_ONE, - 0x32: GHOSTTY_KEY_TWO, - 0x33: GHOSTTY_KEY_THREE, - 0x34: GHOSTTY_KEY_FOUR, - 0x35: GHOSTTY_KEY_FIVE, - 0x36: GHOSTTY_KEY_SIX, - 0x37: GHOSTTY_KEY_SEVEN, - 0x38: GHOSTTY_KEY_EIGHT, - 0x39: GHOSTTY_KEY_NINE, - - // A-Z - 0x41: GHOSTTY_KEY_A, - 0x42: GHOSTTY_KEY_B, - 0x43: GHOSTTY_KEY_C, - 0x44: GHOSTTY_KEY_D, - 0x45: GHOSTTY_KEY_E, - 0x46: GHOSTTY_KEY_F, - 0x47: GHOSTTY_KEY_G, - 0x48: GHOSTTY_KEY_H, - 0x49: GHOSTTY_KEY_I, - 0x4A: GHOSTTY_KEY_J, - 0x4B: GHOSTTY_KEY_K, - 0x4C: GHOSTTY_KEY_L, - 0x4D: GHOSTTY_KEY_M, - 0x4E: GHOSTTY_KEY_N, - 0x4F: GHOSTTY_KEY_O, - 0x50: GHOSTTY_KEY_P, - 0x51: GHOSTTY_KEY_Q, - 0x52: GHOSTTY_KEY_R, - 0x53: GHOSTTY_KEY_S, - 0x54: GHOSTTY_KEY_T, - 0x55: GHOSTTY_KEY_U, - 0x56: GHOSTTY_KEY_V, - 0x57: GHOSTTY_KEY_W, - 0x58: GHOSTTY_KEY_X, - 0x59: GHOSTTY_KEY_Y, - 0x5A: GHOSTTY_KEY_Z, - - // a-z - 0x61: GHOSTTY_KEY_A, - 0x62: GHOSTTY_KEY_B, - 0x63: GHOSTTY_KEY_C, - 0x64: GHOSTTY_KEY_D, - 0x65: GHOSTTY_KEY_E, - 0x66: GHOSTTY_KEY_F, - 0x67: GHOSTTY_KEY_G, - 0x68: GHOSTTY_KEY_H, - 0x69: GHOSTTY_KEY_I, - 0x6A: GHOSTTY_KEY_J, - 0x6B: GHOSTTY_KEY_K, - 0x6C: GHOSTTY_KEY_L, - 0x6D: GHOSTTY_KEY_M, - 0x6E: GHOSTTY_KEY_N, - 0x6F: GHOSTTY_KEY_O, - 0x70: GHOSTTY_KEY_P, - 0x71: GHOSTTY_KEY_Q, - 0x72: GHOSTTY_KEY_R, - 0x73: GHOSTTY_KEY_S, - 0x74: GHOSTTY_KEY_T, - 0x75: GHOSTTY_KEY_U, - 0x76: GHOSTTY_KEY_V, - 0x77: GHOSTTY_KEY_W, - 0x78: GHOSTTY_KEY_X, - 0x79: GHOSTTY_KEY_Y, - 0x7A: GHOSTTY_KEY_Z, - - // Symbols - 0x27: GHOSTTY_KEY_APOSTROPHE, - 0x5C: GHOSTTY_KEY_BACKSLASH, - 0x2C: GHOSTTY_KEY_COMMA, - 0x3D: GHOSTTY_KEY_EQUAL, - 0x60: GHOSTTY_KEY_GRAVE_ACCENT, - 0x5B: GHOSTTY_KEY_LEFT_BRACKET, - 0x2D: GHOSTTY_KEY_MINUS, - 0x2E: GHOSTTY_KEY_PERIOD, - 0x5D: GHOSTTY_KEY_RIGHT_BRACKET, - 0x3B: GHOSTTY_KEY_SEMICOLON, - 0x2F: GHOSTTY_KEY_SLASH, + GHOSTTY_KEY_SPACE: .space, ] // Mapping of event keyCode to ghostty input key values. This is cribbed from // glfw mostly since we started as a glfw-based app way back in the day! static let keycodeToKey: [UInt16 : ghostty_input_key_e] = [ - 0x1D: GHOSTTY_KEY_ZERO, - 0x12: GHOSTTY_KEY_ONE, - 0x13: GHOSTTY_KEY_TWO, - 0x14: GHOSTTY_KEY_THREE, - 0x15: GHOSTTY_KEY_FOUR, - 0x17: GHOSTTY_KEY_FIVE, - 0x16: GHOSTTY_KEY_SIX, - 0x1A: GHOSTTY_KEY_SEVEN, - 0x1C: GHOSTTY_KEY_EIGHT, - 0x19: GHOSTTY_KEY_NINE, + 0x1D: GHOSTTY_KEY_DIGIT_0, + 0x12: GHOSTTY_KEY_DIGIT_1, + 0x13: GHOSTTY_KEY_DIGIT_2, + 0x14: GHOSTTY_KEY_DIGIT_3, + 0x15: GHOSTTY_KEY_DIGIT_4, + 0x17: GHOSTTY_KEY_DIGIT_5, + 0x16: GHOSTTY_KEY_DIGIT_6, + 0x1A: GHOSTTY_KEY_DIGIT_7, + 0x1C: GHOSTTY_KEY_DIGIT_8, + 0x19: GHOSTTY_KEY_DIGIT_9, 0x00: GHOSTTY_KEY_A, 0x0B: GHOSTTY_KEY_B, 0x08: GHOSTTY_KEY_C, @@ -278,22 +132,22 @@ extension Ghostty { 0x10: GHOSTTY_KEY_Y, 0x06: GHOSTTY_KEY_Z, - 0x27: GHOSTTY_KEY_APOSTROPHE, + 0x27: GHOSTTY_KEY_QUOTE, 0x2A: GHOSTTY_KEY_BACKSLASH, 0x2B: GHOSTTY_KEY_COMMA, 0x18: GHOSTTY_KEY_EQUAL, - 0x32: GHOSTTY_KEY_GRAVE_ACCENT, - 0x21: GHOSTTY_KEY_LEFT_BRACKET, + 0x32: GHOSTTY_KEY_BACKQUOTE, + 0x21: GHOSTTY_KEY_BRACKET_LEFT, 0x1B: GHOSTTY_KEY_MINUS, 0x2F: GHOSTTY_KEY_PERIOD, - 0x1E: GHOSTTY_KEY_RIGHT_BRACKET, + 0x1E: GHOSTTY_KEY_BRACKET_RIGHT, 0x29: GHOSTTY_KEY_SEMICOLON, 0x2C: GHOSTTY_KEY_SLASH, 0x33: GHOSTTY_KEY_BACKSPACE, 0x39: GHOSTTY_KEY_CAPS_LOCK, 0x75: GHOSTTY_KEY_DELETE, - 0x7D: GHOSTTY_KEY_DOWN, + 0x7D: GHOSTTY_KEY_ARROW_DOWN, 0x77: GHOSTTY_KEY_END, 0x24: GHOSTTY_KEY_ENTER, 0x35: GHOSTTY_KEY_ESCAPE, @@ -319,39 +173,39 @@ extension Ghostty { 0x5A: GHOSTTY_KEY_F20, 0x73: GHOSTTY_KEY_HOME, 0x72: GHOSTTY_KEY_INSERT, - 0x7B: GHOSTTY_KEY_LEFT, - 0x3A: GHOSTTY_KEY_LEFT_ALT, - 0x3B: GHOSTTY_KEY_LEFT_CONTROL, - 0x38: GHOSTTY_KEY_LEFT_SHIFT, - 0x37: GHOSTTY_KEY_LEFT_SUPER, + 0x7B: GHOSTTY_KEY_ARROW_LEFT, + 0x3A: GHOSTTY_KEY_ALT_LEFT, + 0x3B: GHOSTTY_KEY_CONTROL_LEFT, + 0x38: GHOSTTY_KEY_SHIFT_LEFT, + 0x37: GHOSTTY_KEY_META_LEFT, 0x47: GHOSTTY_KEY_NUM_LOCK, 0x79: GHOSTTY_KEY_PAGE_DOWN, 0x74: GHOSTTY_KEY_PAGE_UP, - 0x7C: GHOSTTY_KEY_RIGHT, - 0x3D: GHOSTTY_KEY_RIGHT_ALT, - 0x3E: GHOSTTY_KEY_RIGHT_CONTROL, - 0x3C: GHOSTTY_KEY_RIGHT_SHIFT, - 0x36: GHOSTTY_KEY_RIGHT_SUPER, + 0x7C: GHOSTTY_KEY_ARROW_RIGHT, + 0x3D: GHOSTTY_KEY_ALT_RIGHT, + 0x3E: GHOSTTY_KEY_CONTROL_RIGHT, + 0x3C: GHOSTTY_KEY_SHIFT_RIGHT, + 0x36: GHOSTTY_KEY_META_RIGHT, 0x31: GHOSTTY_KEY_SPACE, 0x30: GHOSTTY_KEY_TAB, - 0x7E: GHOSTTY_KEY_UP, + 0x7E: GHOSTTY_KEY_ARROW_UP, - 0x52: GHOSTTY_KEY_KP_0, - 0x53: GHOSTTY_KEY_KP_1, - 0x54: GHOSTTY_KEY_KP_2, - 0x55: GHOSTTY_KEY_KP_3, - 0x56: GHOSTTY_KEY_KP_4, - 0x57: GHOSTTY_KEY_KP_5, - 0x58: GHOSTTY_KEY_KP_6, - 0x59: GHOSTTY_KEY_KP_7, - 0x5B: GHOSTTY_KEY_KP_8, - 0x5C: GHOSTTY_KEY_KP_9, - 0x45: GHOSTTY_KEY_KP_ADD, - 0x41: GHOSTTY_KEY_KP_DECIMAL, - 0x4B: GHOSTTY_KEY_KP_DIVIDE, - 0x4C: GHOSTTY_KEY_KP_ENTER, - 0x51: GHOSTTY_KEY_KP_EQUAL, - 0x43: GHOSTTY_KEY_KP_MULTIPLY, - 0x4E: GHOSTTY_KEY_KP_SUBTRACT, + 0x52: GHOSTTY_KEY_NUMPAD_0, + 0x53: GHOSTTY_KEY_NUMPAD_1, + 0x54: GHOSTTY_KEY_NUMPAD_2, + 0x55: GHOSTTY_KEY_NUMPAD_3, + 0x56: GHOSTTY_KEY_NUMPAD_4, + 0x57: GHOSTTY_KEY_NUMPAD_5, + 0x58: GHOSTTY_KEY_NUMPAD_6, + 0x59: GHOSTTY_KEY_NUMPAD_7, + 0x5B: GHOSTTY_KEY_NUMPAD_8, + 0x5C: GHOSTTY_KEY_NUMPAD_9, + 0x45: GHOSTTY_KEY_NUMPAD_ADD, + 0x41: GHOSTTY_KEY_NUMPAD_DECIMAL, + 0x4B: GHOSTTY_KEY_NUMPAD_DIVIDE, + 0x4C: GHOSTTY_KEY_NUMPAD_ENTER, + 0x51: GHOSTTY_KEY_NUMPAD_EQUAL, + 0x43: GHOSTTY_KEY_NUMPAD_MULTIPLY, + 0x4E: GHOSTTY_KEY_NUMPAD_SUBTRACT, ]; } diff --git a/src/apprt/embedded.zig b/src/apprt/embedded.zig index c953300cd..cf3f73a55 100644 --- a/src/apprt/embedded.zig +++ b/src/apprt/embedded.zig @@ -92,41 +92,12 @@ pub const App = struct { // We want to get the physical unmapped key to process keybinds. const physical_key = keycode: for (input.keycodes.entries) |entry| { if (entry.native == self.keycode) break :keycode entry.key; - } else .invalid; - - // If the resulting text has length 1 then we can take its key - // and attempt to translate it to a key enum and call the key callback. - // If the length is greater than 1 then we're going to call the - // charCallback. - // - // We also only do key translation if this is not a dead key. - const key = if (!self.composing) key: { - // If our physical key is a keypad key, we use that. - if (physical_key.keypad()) break :key physical_key; - - // A completed key. If the length of the key is one then we can - // attempt to translate it to a key enum and call the key - // callback. First try plain ASCII. - if (text.len > 0) { - if (input.Key.fromASCII(text[0])) |key| { - break :key key; - } - } - - // If the above doesn't work, we use the unmodified value. - if (std.math.cast(u8, unshifted_codepoint)) |ascii| { - if (input.Key.fromASCII(ascii)) |key| { - break :key key; - } - } - - break :key physical_key; - } else .invalid; + } else .unidentified; // Build our final key event return .{ .action = self.action, - .key = key, + .key = physical_key, .physical_key = physical_key, .mods = self.mods, .consumed_mods = self.consumed_mods, diff --git a/src/input/key.zig b/src/input/key.zig index b39c5e5d3..c0deea25c 100644 --- a/src/input/key.zig +++ b/src/input/key.zig @@ -270,7 +270,7 @@ pub const Action = enum(c_int) { /// UTF-8 and are produced by the associated apprt. Ghostty core has /// no mechanism to map input events to strings without the apprt. /// -/// IMPORTANT: Any changes here update include/ghostty.h +/// IMPORTANT: Any changes here update include/ghostty.h ghostty_input_key_e pub const Key = enum(c_int) { unidentified, @@ -618,61 +618,61 @@ pub const Key = enum(c_int) { /// Returns the cimgui key constant for this key. pub fn imguiKey(self: Key) ?c_uint { return switch (self) { - .a => cimgui.c.ImGuiKey_A, - .b => cimgui.c.ImGuiKey_B, - .c => cimgui.c.ImGuiKey_C, - .d => cimgui.c.ImGuiKey_D, - .e => cimgui.c.ImGuiKey_E, - .f => cimgui.c.ImGuiKey_F, - .g => cimgui.c.ImGuiKey_G, - .h => cimgui.c.ImGuiKey_H, - .i => cimgui.c.ImGuiKey_I, - .j => cimgui.c.ImGuiKey_J, - .k => cimgui.c.ImGuiKey_K, - .l => cimgui.c.ImGuiKey_L, - .m => cimgui.c.ImGuiKey_M, - .n => cimgui.c.ImGuiKey_N, - .o => cimgui.c.ImGuiKey_O, - .p => cimgui.c.ImGuiKey_P, - .q => cimgui.c.ImGuiKey_Q, - .r => cimgui.c.ImGuiKey_R, - .s => cimgui.c.ImGuiKey_S, - .t => cimgui.c.ImGuiKey_T, - .u => cimgui.c.ImGuiKey_U, - .v => cimgui.c.ImGuiKey_V, - .w => cimgui.c.ImGuiKey_W, - .x => cimgui.c.ImGuiKey_X, - .y => cimgui.c.ImGuiKey_Y, - .z => cimgui.c.ImGuiKey_Z, + .key_a => cimgui.c.ImGuiKey_A, + .key_b => cimgui.c.ImGuiKey_B, + .key_c => cimgui.c.ImGuiKey_C, + .key_d => cimgui.c.ImGuiKey_D, + .key_e => cimgui.c.ImGuiKey_E, + .key_f => cimgui.c.ImGuiKey_F, + .key_g => cimgui.c.ImGuiKey_G, + .key_h => cimgui.c.ImGuiKey_H, + .key_i => cimgui.c.ImGuiKey_I, + .key_j => cimgui.c.ImGuiKey_J, + .key_k => cimgui.c.ImGuiKey_K, + .key_l => cimgui.c.ImGuiKey_L, + .key_m => cimgui.c.ImGuiKey_M, + .key_n => cimgui.c.ImGuiKey_N, + .key_o => cimgui.c.ImGuiKey_O, + .key_p => cimgui.c.ImGuiKey_P, + .key_q => cimgui.c.ImGuiKey_Q, + .key_r => cimgui.c.ImGuiKey_R, + .key_s => cimgui.c.ImGuiKey_S, + .key_t => cimgui.c.ImGuiKey_T, + .key_u => cimgui.c.ImGuiKey_U, + .key_v => cimgui.c.ImGuiKey_V, + .key_w => cimgui.c.ImGuiKey_W, + .key_x => cimgui.c.ImGuiKey_X, + .key_y => cimgui.c.ImGuiKey_Y, + .key_z => cimgui.c.ImGuiKey_Z, - .zero => cimgui.c.ImGuiKey_0, - .one => cimgui.c.ImGuiKey_1, - .two => cimgui.c.ImGuiKey_2, - .three => cimgui.c.ImGuiKey_3, - .four => cimgui.c.ImGuiKey_4, - .five => cimgui.c.ImGuiKey_5, - .six => cimgui.c.ImGuiKey_6, - .seven => cimgui.c.ImGuiKey_7, - .eight => cimgui.c.ImGuiKey_8, - .nine => cimgui.c.ImGuiKey_9, + .digit_0 => cimgui.c.ImGuiKey_0, + .digit_1 => cimgui.c.ImGuiKey_1, + .digit_2 => cimgui.c.ImGuiKey_2, + .digit_3 => cimgui.c.ImGuiKey_3, + .digit_4 => cimgui.c.ImGuiKey_4, + .digit_5 => cimgui.c.ImGuiKey_5, + .digit_6 => cimgui.c.ImGuiKey_6, + .digit_7 => cimgui.c.ImGuiKey_7, + .digit_8 => cimgui.c.ImGuiKey_8, + .digit_9 => cimgui.c.ImGuiKey_9, .semicolon => cimgui.c.ImGuiKey_Semicolon, .space => cimgui.c.ImGuiKey_Space, - .apostrophe => cimgui.c.ImGuiKey_Apostrophe, + .quote => cimgui.c.ImGuiKey_Apostrophe, .comma => cimgui.c.ImGuiKey_Comma, - .grave_accent => cimgui.c.ImGuiKey_GraveAccent, + .backquote => cimgui.c.ImGuiKey_GraveAccent, .period => cimgui.c.ImGuiKey_Period, .slash => cimgui.c.ImGuiKey_Slash, .minus => cimgui.c.ImGuiKey_Minus, .equal => cimgui.c.ImGuiKey_Equal, - .left_bracket => cimgui.c.ImGuiKey_LeftBracket, - .right_bracket => cimgui.c.ImGuiKey_RightBracket, + .bracket_left => cimgui.c.ImGuiKey_LeftBracket, + .bracket_right => cimgui.c.ImGuiKey_RightBracket, .backslash => cimgui.c.ImGuiKey_Backslash, - .up => cimgui.c.ImGuiKey_UpArrow, - .down => cimgui.c.ImGuiKey_DownArrow, - .left => cimgui.c.ImGuiKey_LeftArrow, - .right => cimgui.c.ImGuiKey_RightArrow, + .arrow_up => cimgui.c.ImGuiKey_UpArrow, + .arrow_down => cimgui.c.ImGuiKey_DownArrow, + .arrow_left => cimgui.c.ImGuiKey_LeftArrow, + .arrow_right => cimgui.c.ImGuiKey_RightArrow, .home => cimgui.c.ImGuiKey_Home, .end => cimgui.c.ImGuiKey_End, .insert => cimgui.c.ImGuiKey_Insert, @@ -703,48 +703,47 @@ pub const Key = enum(c_int) { .f11 => cimgui.c.ImGuiKey_F11, .f12 => cimgui.c.ImGuiKey_F12, - .kp_0 => cimgui.c.ImGuiKey_Keypad0, - .kp_1 => cimgui.c.ImGuiKey_Keypad1, - .kp_2 => cimgui.c.ImGuiKey_Keypad2, - .kp_3 => cimgui.c.ImGuiKey_Keypad3, - .kp_4 => cimgui.c.ImGuiKey_Keypad4, - .kp_5 => cimgui.c.ImGuiKey_Keypad5, - .kp_6 => cimgui.c.ImGuiKey_Keypad6, - .kp_7 => cimgui.c.ImGuiKey_Keypad7, - .kp_8 => cimgui.c.ImGuiKey_Keypad8, - .kp_9 => cimgui.c.ImGuiKey_Keypad9, - .kp_decimal => cimgui.c.ImGuiKey_KeypadDecimal, - .kp_divide => cimgui.c.ImGuiKey_KeypadDivide, - .kp_multiply => cimgui.c.ImGuiKey_KeypadMultiply, - .kp_subtract => cimgui.c.ImGuiKey_KeypadSubtract, - .kp_add => cimgui.c.ImGuiKey_KeypadAdd, - .kp_enter => cimgui.c.ImGuiKey_KeypadEnter, - .kp_equal => cimgui.c.ImGuiKey_KeypadEqual, + .numpad_0 => cimgui.c.ImGuiKey_Keypad0, + .numpad_1 => cimgui.c.ImGuiKey_Keypad1, + .numpad_2 => cimgui.c.ImGuiKey_Keypad2, + .numpad_3 => cimgui.c.ImGuiKey_Keypad3, + .numpad_4 => cimgui.c.ImGuiKey_Keypad4, + .numpad_5 => cimgui.c.ImGuiKey_Keypad5, + .numpad_6 => cimgui.c.ImGuiKey_Keypad6, + .numpad_7 => cimgui.c.ImGuiKey_Keypad7, + .numpad_8 => cimgui.c.ImGuiKey_Keypad8, + .numpad_9 => cimgui.c.ImGuiKey_Keypad9, + .numpad_decimal => cimgui.c.ImGuiKey_KeypadDecimal, + .numpad_divide => cimgui.c.ImGuiKey_KeypadDivide, + .numpad_multiply => cimgui.c.ImGuiKey_KeypadMultiply, + .numpad_subtract => cimgui.c.ImGuiKey_KeypadSubtract, + .numpad_add => cimgui.c.ImGuiKey_KeypadAdd, + .numpad_enter => cimgui.c.ImGuiKey_KeypadEnter, + .numpad_equal => cimgui.c.ImGuiKey_KeypadEqual, // We map KP_SEPARATOR to Comma because traditionally a numpad would // have a numeric separator key. Most modern numpads do not - .kp_separator => cimgui.c.ImGuiKey_Comma, - .kp_left => cimgui.c.ImGuiKey_LeftArrow, - .kp_right => cimgui.c.ImGuiKey_RightArrow, - .kp_up => cimgui.c.ImGuiKey_UpArrow, - .kp_down => cimgui.c.ImGuiKey_DownArrow, - .kp_page_up => cimgui.c.ImGuiKey_PageUp, - .kp_page_down => cimgui.c.ImGuiKey_PageUp, - .kp_home => cimgui.c.ImGuiKey_Home, - .kp_end => cimgui.c.ImGuiKey_End, - .kp_insert => cimgui.c.ImGuiKey_Insert, - .kp_delete => cimgui.c.ImGuiKey_Delete, - .kp_begin => cimgui.c.ImGuiKey_NamedKey_BEGIN, + .numpad_left => cimgui.c.ImGuiKey_LeftArrow, + .numpad_right => cimgui.c.ImGuiKey_RightArrow, + .numpad_up => cimgui.c.ImGuiKey_UpArrow, + .numpad_down => cimgui.c.ImGuiKey_DownArrow, + .numpad_page_up => cimgui.c.ImGuiKey_PageUp, + .numpad_page_down => cimgui.c.ImGuiKey_PageUp, + .numpad_home => cimgui.c.ImGuiKey_Home, + .numpad_end => cimgui.c.ImGuiKey_End, + .numpad_insert => cimgui.c.ImGuiKey_Insert, + .numpad_delete => cimgui.c.ImGuiKey_Delete, + .numpad_begin => cimgui.c.ImGuiKey_NamedKey_BEGIN, - .left_shift => cimgui.c.ImGuiKey_LeftShift, - .left_control => cimgui.c.ImGuiKey_LeftCtrl, - .left_alt => cimgui.c.ImGuiKey_LeftAlt, - .left_super => cimgui.c.ImGuiKey_LeftSuper, - .right_shift => cimgui.c.ImGuiKey_RightShift, - .right_control => cimgui.c.ImGuiKey_RightCtrl, - .right_alt => cimgui.c.ImGuiKey_RightAlt, - .right_super => cimgui.c.ImGuiKey_RightSuper, + .shift_left => cimgui.c.ImGuiKey_LeftShift, + .control_left => cimgui.c.ImGuiKey_LeftCtrl, + .alt_left => cimgui.c.ImGuiKey_LeftAlt, + .meta_left => cimgui.c.ImGuiKey_LeftSuper, + .shift_right => cimgui.c.ImGuiKey_RightShift, + .control_right => cimgui.c.ImGuiKey_RightCtrl, + .alt_right => cimgui.c.ImGuiKey_RightAlt, + .meta_right => cimgui.c.ImGuiKey_RightSuper, - .invalid, + // These keys aren't represented in cimgui .f13, .f14, .f15, @@ -758,9 +757,51 @@ pub const Key = enum(c_int) { .f23, .f24, .f25, + .intl_backslash, + .intl_ro, + .intl_yen, + .convert, + .kana_mode, + .non_convert, + .numpad_backspace, + .numpad_clear, + .numpad_clear_entry, + .numpad_comma, + .numpad_memory_add, + .numpad_memory_clear, + .numpad_memory_recall, + .numpad_memory_store, + .numpad_memory_subtract, + .numpad_paren_left, + .numpad_paren_right, + .@"fn", + .fn_lock, + .browser_back, + .browser_favorites, + .browser_forward, + .browser_home, + .browser_refresh, + .browser_search, + .browser_stop, + .eject, + .launch_app_1, + .launch_app_2, + .launch_mail, + .media_play_pause, + .media_select, + .media_stop, + .media_track_next, + .media_track_previous, + .power, + .sleep, + .audio_volume_down, + .audio_volume_mute, + .audio_volume_up, + .wake_up, + .help, + => null, - // These keys aren't represented in cimgui - .plus, + .unidentified, => null, }; } diff --git a/src/input/keycodes.zig b/src/input/keycodes.zig index e9adbc156..fa95ff206 100644 --- a/src/input/keycodes.zig +++ b/src/input/keycodes.zig @@ -19,7 +19,7 @@ pub const entries: []const Entry = entries: { for (raw_entries, 0..) |raw, i| { @setEvalBranchQuota(10000); result[i] = .{ - .key = code_to_key.get(raw[5]) orelse .invalid, + .key = code_to_key.get(raw[5]) orelse .unidentified, .usb = raw[0], .code = raw[5], .native = raw[native_idx], @@ -45,42 +45,42 @@ pub const Entry = struct { const code_to_key = code_to_key: { @setEvalBranchQuota(5000); break :code_to_key std.StaticStringMap(Key).initComptime(.{ - .{ "KeyA", .a }, - .{ "KeyB", .b }, - .{ "KeyC", .c }, - .{ "KeyD", .d }, - .{ "KeyE", .e }, - .{ "KeyF", .f }, - .{ "KeyG", .g }, - .{ "KeyH", .h }, - .{ "KeyI", .i }, - .{ "KeyJ", .j }, - .{ "KeyK", .k }, - .{ "KeyL", .l }, - .{ "KeyM", .m }, - .{ "KeyN", .n }, - .{ "KeyO", .o }, - .{ "KeyP", .p }, - .{ "KeyQ", .q }, - .{ "KeyR", .r }, - .{ "KeyS", .s }, - .{ "KeyT", .t }, - .{ "KeyU", .u }, - .{ "KeyV", .v }, - .{ "KeyW", .w }, - .{ "KeyX", .x }, - .{ "KeyY", .y }, - .{ "KeyZ", .z }, - .{ "Digit1", .one }, - .{ "Digit2", .two }, - .{ "Digit3", .three }, - .{ "Digit4", .four }, - .{ "Digit5", .five }, - .{ "Digit6", .six }, - .{ "Digit7", .seven }, - .{ "Digit8", .eight }, - .{ "Digit9", .nine }, - .{ "Digit0", .zero }, + .{ "KeyA", .key_a }, + .{ "KeyB", .key_b }, + .{ "KeyC", .key_c }, + .{ "KeyD", .key_d }, + .{ "KeyE", .key_e }, + .{ "KeyF", .key_f }, + .{ "KeyG", .key_g }, + .{ "KeyH", .key_h }, + .{ "KeyI", .key_i }, + .{ "KeyJ", .key_j }, + .{ "KeyK", .key_k }, + .{ "KeyL", .key_l }, + .{ "KeyM", .key_m }, + .{ "KeyN", .key_n }, + .{ "KeyO", .key_o }, + .{ "KeyP", .key_p }, + .{ "KeyQ", .key_q }, + .{ "KeyR", .key_r }, + .{ "KeyS", .key_s }, + .{ "KeyT", .key_t }, + .{ "KeyU", .key_u }, + .{ "KeyV", .key_v }, + .{ "KeyW", .key_w }, + .{ "KeyX", .key_x }, + .{ "KeyY", .key_y }, + .{ "KeyZ", .key_z }, + .{ "Digit1", .digit_1 }, + .{ "Digit2", .digit_2 }, + .{ "Digit3", .digit_3 }, + .{ "Digit4", .digit_4 }, + .{ "Digit5", .digit_5 }, + .{ "Digit6", .digit_6 }, + .{ "Digit7", .digit_7 }, + .{ "Digit8", .digit_8 }, + .{ "Digit9", .digit_9 }, + .{ "Digit0", .digit_0 }, .{ "Enter", .enter }, .{ "Escape", .escape }, .{ "Backspace", .backspace }, @@ -88,12 +88,12 @@ const code_to_key = code_to_key: { .{ "Space", .space }, .{ "Minus", .minus }, .{ "Equal", .equal }, - .{ "BracketLeft", .left_bracket }, - .{ "BracketRight", .right_bracket }, + .{ "BracketLeft", .bracket_left }, + .{ "BracketRight", .bracket_left }, .{ "Backslash", .backslash }, .{ "Semicolon", .semicolon }, - .{ "Quote", .apostrophe }, - .{ "Backquote", .grave_accent }, + .{ "Quote", .quote }, + .{ "Backquote", .backquote }, .{ "Comma", .comma }, .{ "Period", .period }, .{ "Slash", .slash }, @@ -131,37 +131,37 @@ const code_to_key = code_to_key: { .{ "Delete", .delete }, .{ "End", .end }, .{ "PageDown", .page_down }, - .{ "ArrowRight", .right }, - .{ "ArrowLeft", .left }, - .{ "ArrowDown", .down }, - .{ "ArrowUp", .up }, + .{ "ArrowRight", .arrow_right }, + .{ "ArrowLeft", .arrow_left }, + .{ "ArrowDown", .arrow_down }, + .{ "ArrowUp", .arrow_up }, .{ "NumLock", .num_lock }, - .{ "NumpadDivide", .kp_divide }, - .{ "NumpadMultiply", .kp_multiply }, - .{ "NumpadSubtract", .kp_subtract }, - .{ "NumpadAdd", .kp_add }, - .{ "NumpadEnter", .kp_enter }, - .{ "Numpad1", .kp_1 }, - .{ "Numpad2", .kp_2 }, - .{ "Numpad3", .kp_3 }, - .{ "Numpad4", .kp_4 }, - .{ "Numpad5", .kp_5 }, - .{ "Numpad6", .kp_6 }, - .{ "Numpad7", .kp_7 }, - .{ "Numpad8", .kp_8 }, - .{ "Numpad9", .kp_9 }, - .{ "Numpad0", .kp_0 }, - .{ "NumpadDecimal", .kp_decimal }, - .{ "NumpadEqual", .kp_equal }, + .{ "NumpadDivide", .numpad_divide }, + .{ "NumpadMultiply", .numpad_multiply }, + .{ "NumpadSubtract", .numpad_subtract }, + .{ "NumpadAdd", .numpad_add }, + .{ "NumpadEnter", .numpad_enter }, + .{ "Numpad1", .numpad_1 }, + .{ "Numpad2", .numpad_2 }, + .{ "Numpad3", .numpad_3 }, + .{ "Numpad4", .numpad_4 }, + .{ "Numpad5", .numpad_5 }, + .{ "Numpad6", .numpad_6 }, + .{ "Numpad7", .numpad_7 }, + .{ "Numpad8", .numpad_8 }, + .{ "Numpad9", .numpad_9 }, + .{ "Numpad0", .numpad_0 }, + .{ "NumpadDecimal", .numpad_decimal }, + .{ "NumpadEqual", .numpad_equal }, .{ "ContextMenu", .context_menu }, - .{ "ControlLeft", .left_control }, - .{ "ShiftLeft", .left_shift }, - .{ "AltLeft", .left_alt }, - .{ "MetaLeft", .left_super }, - .{ "ControlRight", .right_control }, - .{ "ShiftRight", .right_shift }, - .{ "AltRight", .right_alt }, - .{ "MetaRight", .right_super }, + .{ "ControlLeft", .control_left }, + .{ "ShiftLeft", .shift_left }, + .{ "AltLeft", .alt_left }, + .{ "MetaLeft", .meta_left }, + .{ "ControlRight", .control_right }, + .{ "ShiftRight", .shift_right }, + .{ "AltRight", .alt_right }, + .{ "MetaRight", .meta_right }, }); };