Skip to main content

Key

Enum Key 

Source
#[repr(u32)]
pub enum Key {
Show 175 variants Unidentified = 0, Grave = 1, Backslash = 2, BracketLeft = 3, BracketRight = 4, Comma = 5, Zero = 6, One = 7, Two = 8, Three = 9, Four = 10, Five = 11, Six = 12, Seven = 13, Eight = 14, Nine = 15, Equal = 16, IntlBackslash = 17, IntlRo = 18, IntlYen = 19, A = 20, B = 21, C = 22, D = 23, E = 24, F = 25, G = 26, H = 27, I = 28, J = 29, K = 30, L = 31, M = 32, N = 33, O = 34, P = 35, Q = 36, R = 37, S = 38, T = 39, U = 40, V = 41, W = 42, X = 43, Y = 44, Z = 45, Minus = 46, Period = 47, Quote = 48, Semicolon = 49, Slash = 50, AltLeft = 51, AltRight = 52, Backspace = 53, CapsLock = 54, ContextMenu = 55, ControlLeft = 56, ControlRight = 57, Enter = 58, MetaLeft = 59, MetaRight = 60, ShiftLeft = 61, ShiftRight = 62, Space = 63, Tab = 64, Convert = 65, KanaMode = 66, NonConvert = 67, Delete = 68, End = 69, Help = 70, Home = 71, Insert = 72, PageDown = 73, PageUp = 74, Down = 75, Left = 76, Right = 77, Up = 78, NumLock = 79, Kp0 = 80, Kp1 = 81, Kp2 = 82, Kp3 = 83, Kp4 = 84, Kp5 = 85, Kp6 = 86, Kp7 = 87, Kp8 = 88, Kp9 = 89, KpPlus = 90, KpBackspace = 91, KpClear = 92, KpClearEntry = 93, KpComma = 94, KpPeriod = 95, KpDivide = 96, KpEnter = 97, KpEqual = 98, KpMemoryAdd = 99, KpMemoryClear = 100, KpMemoryRecall = 101, KpMemoryStore = 102, KpMemorySubtract = 103, KpMultiply = 104, KpParenLeft = 105, KpParenRight = 106, KpMinus = 107, KpSeparator = 108, NumpadUp = 109, NumpadDown = 110, NumpadRight = 111, NumpadLeft = 112, NumpadBegin = 113, NumpadHome = 114, NumpadEnd = 115, NumpadInsert = 116, NumpadDelete = 117, NumpadPageUp = 118, NumpadPageDown = 119, Escape = 120, F1 = 121, F2 = 122, F3 = 123, F4 = 124, F5 = 125, F6 = 126, F7 = 127, F8 = 128, F9 = 129, F10 = 130, F11 = 131, F12 = 132, F13 = 133, F14 = 134, F15 = 135, F16 = 136, F17 = 137, F18 = 138, F19 = 139, F20 = 140, F21 = 141, F22 = 142, F23 = 143, F24 = 144, F25 = 145, FnLock = 146, PrintScreen = 147, ScrollLock = 148, Pause = 149, BrowserBack = 150, BrowserFavorites = 151, BrowserForward = 152, BrowserHome = 153, BrowserRefresh = 154, BrowserSearch = 155, BrowserStop = 156, Eject = 157, LaunchApp1 = 158, LaunchApp2 = 159, LaunchMail = 160, MediaPlayPause = 161, MediaSelect = 162, MediaStop = 163, MediaTrackNext = 164, MediaTrackPrevious = 165, Power = 166, Sleep = 167, AudioVolumeDown = 168, AudioVolumeMute = 169, AudioVolumeUp = 170, WakeUp = 171, Copy = 172, Cut = 173, Paste = 174,
}
Expand description

Physical key codes matching Ghostty’s internal Key enum.

These values are used by Ghostty’s key encoder to produce correct escape sequences. Reference: ghostty/src/input/key.zig

Variants§

§

Unidentified = 0

§

Grave = 1

` and ~

§

Backslash = 2

\ and |

§

BracketLeft = 3

[ and {

§

BracketRight = 4

] and }

§

Comma = 5

, and <

§

Zero = 6

§

One = 7

§

Two = 8

§

Three = 9

§

Four = 10

§

Five = 11

§

Six = 12

§

Seven = 13

§

Eight = 14

§

Nine = 15

§

Equal = 16

= and +

§

IntlBackslash = 17

§

IntlRo = 18

§

IntlYen = 19

§

A = 20

§

B = 21

§

C = 22

§

D = 23

§

E = 24

§

F = 25

§

G = 26

§

H = 27

§

I = 28

§

J = 29

§

K = 30

§

L = 31

§

M = 32

§

N = 33

§

O = 34

§

P = 35

§

Q = 36

§

R = 37

§

S = 38

§

T = 39

§

U = 40

§

V = 41

§

W = 42

§

X = 43

§

Y = 44

§

Z = 45

§

Minus = 46

- and _

§

Period = 47

. and >

§

Quote = 48

' and "

§

Semicolon = 49

; and :

§

Slash = 50

/ and ?

§

AltLeft = 51

§

AltRight = 52

§

Backspace = 53

§

CapsLock = 54

§

ContextMenu = 55

§

ControlLeft = 56

§

ControlRight = 57

§

Enter = 58

§

MetaLeft = 59

§

MetaRight = 60

§

ShiftLeft = 61

§

ShiftRight = 62

§

Space = 63

§

Tab = 64

§

Convert = 65

§

KanaMode = 66

§

NonConvert = 67

§

Delete = 68

§

End = 69

§

Help = 70

§

Home = 71

§

Insert = 72

§

PageDown = 73

§

PageUp = 74

§

Down = 75

§

Left = 76

§

Right = 77

§

Up = 78

§

NumLock = 79

§

Kp0 = 80

§

Kp1 = 81

§

Kp2 = 82

§

Kp3 = 83

§

Kp4 = 84

§

Kp5 = 85

§

Kp6 = 86

§

Kp7 = 87

§

Kp8 = 88

§

Kp9 = 89

§

KpPlus = 90

Keypad +

§

KpBackspace = 91

§

KpClear = 92

§

KpClearEntry = 93

§

KpComma = 94

§

KpPeriod = 95

Keypad .

§

KpDivide = 96

Keypad /

§

KpEnter = 97

Keypad Enter

§

KpEqual = 98

§

KpMemoryAdd = 99

§

KpMemoryClear = 100

§

KpMemoryRecall = 101

§

KpMemoryStore = 102

§

KpMemorySubtract = 103

§

KpMultiply = 104

Keypad *

§

KpParenLeft = 105

§

KpParenRight = 106

§

KpMinus = 107

Keypad -

§

KpSeparator = 108

§

NumpadUp = 109

§

NumpadDown = 110

§

NumpadRight = 111

§

NumpadLeft = 112

§

NumpadBegin = 113

§

NumpadHome = 114

§

NumpadEnd = 115

§

NumpadInsert = 116

§

NumpadDelete = 117

§

NumpadPageUp = 118

§

NumpadPageDown = 119

§

Escape = 120

§

F1 = 121

§

F2 = 122

§

F3 = 123

§

F4 = 124

§

F5 = 125

§

F6 = 126

§

F7 = 127

§

F8 = 128

§

F9 = 129

§

F10 = 130

§

F11 = 131

§

F12 = 132

§

F13 = 133

§

F14 = 134

§

F15 = 135

§

F16 = 136

§

F17 = 137

§

F18 = 138

§

F19 = 139

§

F20 = 140

§

F21 = 141

§

F22 = 142

§

F23 = 143

§

F24 = 144

§

F25 = 145

§

FnLock = 146

§

PrintScreen = 147

§

ScrollLock = 148

§

Pause = 149

§

BrowserBack = 150

§

BrowserFavorites = 151

§

BrowserForward = 152

§

BrowserHome = 153

§

BrowserRefresh = 154

§

BrowserSearch = 155

§

BrowserStop = 156

§

Eject = 157

§

LaunchApp1 = 158

§

LaunchApp2 = 159

§

LaunchMail = 160

§

MediaPlayPause = 161

§

MediaSelect = 162

§

MediaStop = 163

§

MediaTrackNext = 164

§

MediaTrackPrevious = 165

§

Power = 166

§

Sleep = 167

§

AudioVolumeDown = 168

§

AudioVolumeMute = 169

§

AudioVolumeUp = 170

§

WakeUp = 171

§

Copy = 172

§

Cut = 173

§

Paste = 174

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Key

Source§

impl Debug for Key

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Key

Source§

impl Hash for Key

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Key

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Key

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnsafeUnpin for Key

§

impl UnwindSafe for Key

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more