interstice_abi/host_calls/input/key_code.rs
1use crate::interstice_abi_macros::IntersticeType;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Deserialize, Serialize, IntersticeType, Clone)]
5pub enum KeyCode {
6 /// <kbd>`</kbd> on a US keyboard. This is also called a backtick or grave.
7 /// This is the <kbd>半角</kbd>/<kbd>全角</kbd>/<kbd>漢字</kbd>
8 /// (hankaku/zenkaku/kanji) key on Japanese keyboards
9 Backquote,
10 /// Used for both the US <kbd>\\</kbd> (on the 101-key layout) and also for the key
11 /// located between the <kbd>"</kbd> and <kbd>Enter</kbd> keys on row C of the 102-,
12 /// 104- and 106-key layouts.
13 /// Labeled <kbd>#</kbd> on a UK (102) keyboard.
14 Backslash,
15 /// <kbd>[</kbd> on a US keyboard.
16 BracketLeft,
17 /// <kbd>]</kbd> on a US keyboard.
18 BracketRight,
19 /// <kbd>,</kbd> on a US keyboard.
20 Comma,
21 /// <kbd>0</kbd> on a US keyboard.
22 Digit0,
23 /// <kbd>1</kbd> on a US keyboard.
24 Digit1,
25 /// <kbd>2</kbd> on a US keyboard.
26 Digit2,
27 /// <kbd>3</kbd> on a US keyboard.
28 Digit3,
29 /// <kbd>4</kbd> on a US keyboard.
30 Digit4,
31 /// <kbd>5</kbd> on a US keyboard.
32 Digit5,
33 /// <kbd>6</kbd> on a US keyboard.
34 Digit6,
35 /// <kbd>7</kbd> on a US keyboard.
36 Digit7,
37 /// <kbd>8</kbd> on a US keyboard.
38 Digit8,
39 /// <kbd>9</kbd> on a US keyboard.
40 Digit9,
41 /// <kbd>=</kbd> on a US keyboard.
42 Equal,
43 /// Located between the left <kbd>Shift</kbd> and <kbd>Z</kbd> keys.
44 /// Labeled <kbd>\\</kbd> on a UK keyboard.
45 IntlBackslash,
46 /// Located between the <kbd>/</kbd> and right <kbd>Shift</kbd> keys.
47 /// Labeled <kbd>\\</kbd> (ro) on a Japanese keyboard.
48 IntlRo,
49 /// Located between the <kbd>=</kbd> and <kbd>Backspace</kbd> keys.
50 /// Labeled <kbd>¥</kbd> (yen) on a Japanese keyboard. <kbd>\\</kbd> on a
51 /// Russian keyboard.
52 IntlYen,
53 /// <kbd>a</kbd> on a US keyboard.
54 /// Labeled <kbd>q</kbd> on an AZERTY (e.g., French) keyboard.
55 KeyA,
56 /// <kbd>b</kbd> on a US keyboard.
57 KeyB,
58 /// <kbd>c</kbd> on a US keyboard.
59 KeyC,
60 /// <kbd>d</kbd> on a US keyboard.
61 KeyD,
62 /// <kbd>e</kbd> on a US keyboard.
63 KeyE,
64 /// <kbd>f</kbd> on a US keyboard.
65 KeyF,
66 /// <kbd>g</kbd> on a US keyboard.
67 KeyG,
68 /// <kbd>h</kbd> on a US keyboard.
69 KeyH,
70 /// <kbd>i</kbd> on a US keyboard.
71 KeyI,
72 /// <kbd>j</kbd> on a US keyboard.
73 KeyJ,
74 /// <kbd>k</kbd> on a US keyboard.
75 KeyK,
76 /// <kbd>l</kbd> on a US keyboard.
77 KeyL,
78 /// <kbd>m</kbd> on a US keyboard.
79 KeyM,
80 /// <kbd>n</kbd> on a US keyboard.
81 KeyN,
82 /// <kbd>o</kbd> on a US keyboard.
83 KeyO,
84 /// <kbd>p</kbd> on a US keyboard.
85 KeyP,
86 /// <kbd>q</kbd> on a US keyboard.
87 /// Labeled <kbd>a</kbd> on an AZERTY (e.g., French) keyboard.
88 KeyQ,
89 /// <kbd>r</kbd> on a US keyboard.
90 KeyR,
91 /// <kbd>s</kbd> on a US keyboard.
92 KeyS,
93 /// <kbd>t</kbd> on a US keyboard.
94 KeyT,
95 /// <kbd>u</kbd> on a US keyboard.
96 KeyU,
97 /// <kbd>v</kbd> on a US keyboard.
98 KeyV,
99 /// <kbd>w</kbd> on a US keyboard.
100 /// Labeled <kbd>z</kbd> on an AZERTY (e.g., French) keyboard.
101 KeyW,
102 /// <kbd>x</kbd> on a US keyboard.
103 KeyX,
104 /// <kbd>y</kbd> on a US keyboard.
105 /// Labeled <kbd>z</kbd> on a QWERTZ (e.g., German) keyboard.
106 KeyY,
107 /// <kbd>z</kbd> on a US keyboard.
108 /// Labeled <kbd>w</kbd> on an AZERTY (e.g., French) keyboard, and <kbd>y</kbd> on a
109 /// QWERTZ (e.g., German) keyboard.
110 KeyZ,
111 /// <kbd>-</kbd> on a US keyboard.
112 Minus,
113 /// <kbd>.</kbd> on a US keyboard.
114 Period,
115 /// <kbd>'</kbd> on a US keyboard.
116 Quote,
117 /// <kbd>;</kbd> on a US keyboard.
118 Semicolon,
119 /// <kbd>/</kbd> on a US keyboard.
120 Slash,
121 /// <kbd>Alt</kbd>, <kbd>Option</kbd>, or <kbd>⌥</kbd>.
122 AltLeft,
123 /// <kbd>Alt</kbd>, <kbd>Option</kbd>, or <kbd>⌥</kbd>.
124 /// This is labeled <kbd>AltGr</kbd> on many keyboard layouts.
125 AltRight,
126 /// <kbd>Backspace</kbd> or <kbd>⌫</kbd>.
127 /// Labeled <kbd>Delete</kbd> on Apple keyboards.
128 Backspace,
129 /// <kbd>CapsLock</kbd> or <kbd>⇪</kbd>
130 CapsLock,
131 /// The application context menu key, which is typically found between the right
132 /// <kbd>Super</kbd> key and the right <kbd>Control</kbd> key.
133 ContextMenu,
134 /// <kbd>Control</kbd> or <kbd>⌃</kbd>
135 ControlLeft,
136 /// <kbd>Control</kbd> or <kbd>⌃</kbd>
137 ControlRight,
138 /// <kbd>Enter</kbd> or <kbd>↵</kbd>. Labeled <kbd>Return</kbd> on Apple keyboards.
139 Enter,
140 /// The Windows, <kbd>⌘</kbd>, <kbd>Command</kbd>, or other OS symbol key.
141 SuperLeft,
142 /// The Windows, <kbd>⌘</kbd>, <kbd>Command</kbd>, or other OS symbol key.
143 SuperRight,
144 /// <kbd>Shift</kbd> or <kbd>⇧</kbd>
145 ShiftLeft,
146 /// <kbd>Shift</kbd> or <kbd>⇧</kbd>
147 ShiftRight,
148 /// <kbd> </kbd> (space)
149 Space,
150 /// <kbd>Tab</kbd> or <kbd>⇥</kbd>
151 Tab,
152 /// Japanese: <kbd>変</kbd> (henkan)
153 Convert,
154 /// Japanese: <kbd>カタカナ</kbd>/<kbd>ひらがな</kbd>/<kbd>ローマ字</kbd> (katakana/hiragana/romaji)
155 KanaMode,
156 /// Korean: HangulMode <kbd>한/영</kbd> (han/yeong)
157 ///
158 /// Japanese (Mac keyboard): <kbd>か</kbd> (kana)
159 Lang1,
160 /// Korean: Hanja <kbd>한</kbd> (hanja)
161 ///
162 /// Japanese (Mac keyboard): <kbd>英</kbd> (eisu)
163 Lang2,
164 /// Japanese (word-processing keyboard): Katakana
165 Lang3,
166 /// Japanese (word-processing keyboard): Hiragana
167 Lang4,
168 /// Japanese (word-processing keyboard): Zenkaku/Hankaku
169 Lang5,
170 /// Japanese: <kbd>無変換</kbd> (muhenkan)
171 NonConvert,
172 /// <kbd>⌦</kbd>. The forward delete key.
173 /// Note that on Apple keyboards, the key labelled <kbd>Delete</kbd> on the main part of
174 /// the keyboard is encoded as [`Backspace`].
175 ///
176 /// [`Backspace`]: Self::Backspace
177 Delete,
178 /// <kbd>Page Down</kbd>, <kbd>End</kbd>, or <kbd>↘</kbd>
179 End,
180 /// <kbd>Help</kbd>. Not present on standard PC keyboards.
181 Help,
182 /// <kbd>Home</kbd> or <kbd>↖</kbd>
183 Home,
184 /// <kbd>Insert</kbd> or <kbd>Ins</kbd>. Not present on Apple keyboards.
185 Insert,
186 /// <kbd>Page Down</kbd>, <kbd>PgDn</kbd>, or <kbd>⇟</kbd>
187 PageDown,
188 /// <kbd>Page Up</kbd>, <kbd>PgUp</kbd>, or <kbd>⇞</kbd>
189 PageUp,
190 /// <kbd>↓</kbd>
191 ArrowDown,
192 /// <kbd>←</kbd>
193 ArrowLeft,
194 /// <kbd>→</kbd>
195 ArrowRight,
196 /// <kbd>↑</kbd>
197 ArrowUp,
198 /// On the Mac, this is used for the numpad <kbd>Clear</kbd> key.
199 NumLock,
200 /// <kbd>0 Ins</kbd> on a keyboard. <kbd>0</kbd> on a phone or remote control
201 Numpad0,
202 /// <kbd>1 End</kbd> on a keyboard. <kbd>1</kbd> or <kbd>1 QZ</kbd> on a phone or remote control
203 Numpad1,
204 /// <kbd>2 ↓</kbd> on a keyboard. <kbd>2 ABC</kbd> on a phone or remote control
205 Numpad2,
206 /// <kbd>3 PgDn</kbd> on a keyboard. <kbd>3 DEF</kbd> on a phone or remote control
207 Numpad3,
208 /// <kbd>4 ←</kbd> on a keyboard. <kbd>4 GHI</kbd> on a phone or remote control
209 Numpad4,
210 /// <kbd>5</kbd> on a keyboard. <kbd>5 JKL</kbd> on a phone or remote control
211 Numpad5,
212 /// <kbd>6 →</kbd> on a keyboard. <kbd>6 MNO</kbd> on a phone or remote control
213 Numpad6,
214 /// <kbd>7 Home</kbd> on a keyboard. <kbd>7 PQRS</kbd> or <kbd>7 PRS</kbd> on a phone
215 /// or remote control
216 Numpad7,
217 /// <kbd>8 ↑</kbd> on a keyboard. <kbd>8 TUV</kbd> on a phone or remote control
218 Numpad8,
219 /// <kbd>9 PgUp</kbd> on a keyboard. <kbd>9 WXYZ</kbd> or <kbd>9 WXY</kbd> on a phone
220 /// or remote control
221 Numpad9,
222 /// <kbd>+</kbd>
223 NumpadAdd,
224 /// Found on the Microsoft Natural Keyboard.
225 NumpadBackspace,
226 /// <kbd>C</kbd> or <kbd>A</kbd> (All Clear). Also for use with numpads that have a
227 /// <kbd>Clear</kbd> key that is separate from the <kbd>NumLock</kbd> key. On the Mac, the
228 /// numpad <kbd>Clear</kbd> key is encoded as [`NumLock`].
229 ///
230 /// [`NumLock`]: Self::NumLock
231 NumpadClear,
232 /// <kbd>C</kbd> (Clear Entry)
233 NumpadClearEntry,
234 /// <kbd>,</kbd> (thousands separator). For locales where the thousands separator
235 /// is a "." (e.g., Brazil), this key may generate a <kbd>.</kbd>.
236 NumpadComma,
237 /// <kbd>. Del</kbd>. For locales where the decimal separator is "," (e.g.,
238 /// Brazil), this key may generate a <kbd>,</kbd>.
239 NumpadDecimal,
240 /// <kbd>/</kbd>
241 NumpadDivide,
242 NumpadEnter,
243 /// <kbd>=</kbd>
244 NumpadEqual,
245 /// <kbd>#</kbd> on a phone or remote control device. This key is typically found
246 /// below the <kbd>9</kbd> key and to the right of the <kbd>0</kbd> key.
247 NumpadHash,
248 /// <kbd>M</kbd> Add current entry to the value stored in memory.
249 NumpadMemoryAdd,
250 /// <kbd>M</kbd> Clear the value stored in memory.
251 NumpadMemoryClear,
252 /// <kbd>M</kbd> Replace the current entry with the value stored in memory.
253 NumpadMemoryRecall,
254 /// <kbd>M</kbd> Replace the value stored in memory with the current entry.
255 NumpadMemoryStore,
256 /// <kbd>M</kbd> Subtract current entry from the value stored in memory.
257 NumpadMemorySubtract,
258 /// <kbd>*</kbd> on a keyboard. For use with numpads that provide mathematical
259 /// operations (<kbd>+</kbd>, <kbd>-</kbd> <kbd>*</kbd> and <kbd>/</kbd>).
260 ///
261 /// Use `NumpadStar` for the <kbd>*</kbd> key on phones and remote controls.
262 NumpadMultiply,
263 /// <kbd>(</kbd> Found on the Microsoft Natural Keyboard.
264 NumpadParenLeft,
265 /// <kbd>)</kbd> Found on the Microsoft Natural Keyboard.
266 NumpadParenRight,
267 /// <kbd>*</kbd> on a phone or remote control device.
268 ///
269 /// This key is typically found below the <kbd>7</kbd> key and to the left of
270 /// the <kbd>0</kbd> key.
271 ///
272 /// Use <kbd>"NumpadMultiply"</kbd> for the <kbd>*</kbd> key on
273 /// numeric keypads.
274 NumpadStar,
275 /// <kbd>-</kbd>
276 NumpadSubtract,
277 /// <kbd>Esc</kbd> or <kbd>⎋</kbd>
278 Escape,
279 /// <kbd>Fn</kbd> This is typically a hardware key that does not generate a separate code.
280 Fn,
281 /// <kbd>FLock</kbd> or <kbd>FnLock</kbd>. Function Lock key. Found on the Microsoft
282 /// Natural Keyboard.
283 FnLock,
284 /// <kbd>PrtScr SysRq</kbd> or <kbd>Print Screen</kbd>
285 PrintScreen,
286 /// <kbd>Scroll Lock</kbd>
287 ScrollLock,
288 /// <kbd>Pause Break</kbd>
289 Pause,
290 /// Some laptops place this key to the left of the <kbd>↑</kbd> key.
291 ///
292 /// This also the "back" button (triangle) on Android.
293 BrowserBack,
294 BrowserFavorites,
295 /// Some laptops place this key to the right of the <kbd>↑</kbd> key.
296 BrowserForward,
297 /// The "home" button on Android.
298 BrowserHome,
299 BrowserRefresh,
300 BrowserSearch,
301 BrowserStop,
302 /// <kbd>Eject</kbd> or <kbd>⏏</kbd>. This key is placed in the function section on some Apple
303 /// keyboards.
304 Eject,
305 /// Sometimes labelled <kbd>My Computer</kbd> on the keyboard
306 LaunchApp1,
307 /// Sometimes labelled <kbd>Calculator</kbd> on the keyboard
308 LaunchApp2,
309 LaunchMail,
310 MediaPlayPause,
311 MediaSelect,
312 MediaStop,
313 MediaTrackNext,
314 MediaTrackPrevious,
315 /// This key is placed in the function section on some Apple keyboards, replacing the
316 /// <kbd>Eject</kbd> key.
317 Power,
318 Sleep,
319 AudioVolumeDown,
320 AudioVolumeMute,
321 AudioVolumeUp,
322 WakeUp,
323 // Legacy modifier key. Also called "Super" in certain places.
324 Meta,
325 // Legacy modifier key.
326 Hyper,
327 Turbo,
328 Abort,
329 Resume,
330 Suspend,
331 /// Found on Sun’s USB keyboard.
332 Again,
333 /// Found on Sun’s USB keyboard.
334 Copy,
335 /// Found on Sun’s USB keyboard.
336 Cut,
337 /// Found on Sun’s USB keyboard.
338 Find,
339 /// Found on Sun’s USB keyboard.
340 Open,
341 /// Found on Sun’s USB keyboard.
342 Paste,
343 /// Found on Sun’s USB keyboard.
344 Props,
345 /// Found on Sun’s USB keyboard.
346 Select,
347 /// Found on Sun’s USB keyboard.
348 Undo,
349 /// Use for dedicated <kbd>ひらがな</kbd> key found on some Japanese word processing keyboards.
350 Hiragana,
351 /// Use for dedicated <kbd>カタカナ</kbd> key found on some Japanese word processing keyboards.
352 Katakana,
353 /// General-purpose function key.
354 /// Usually found at the top of the keyboard.
355 F1,
356 /// General-purpose function key.
357 /// Usually found at the top of the keyboard.
358 F2,
359 /// General-purpose function key.
360 /// Usually found at the top of the keyboard.
361 F3,
362 /// General-purpose function key.
363 /// Usually found at the top of the keyboard.
364 F4,
365 /// General-purpose function key.
366 /// Usually found at the top of the keyboard.
367 F5,
368 /// General-purpose function key.
369 /// Usually found at the top of the keyboard.
370 F6,
371 /// General-purpose function key.
372 /// Usually found at the top of the keyboard.
373 F7,
374 /// General-purpose function key.
375 /// Usually found at the top of the keyboard.
376 F8,
377 /// General-purpose function key.
378 /// Usually found at the top of the keyboard.
379 F9,
380 /// General-purpose function key.
381 /// Usually found at the top of the keyboard.
382 F10,
383 /// General-purpose function key.
384 /// Usually found at the top of the keyboard.
385 F11,
386 /// General-purpose function key.
387 /// Usually found at the top of the keyboard.
388 F12,
389 /// General-purpose function key.
390 /// Usually found at the top of the keyboard.
391 F13,
392 /// General-purpose function key.
393 /// Usually found at the top of the keyboard.
394 F14,
395 /// General-purpose function key.
396 /// Usually found at the top of the keyboard.
397 F15,
398 /// General-purpose function key.
399 /// Usually found at the top of the keyboard.
400 F16,
401 /// General-purpose function key.
402 /// Usually found at the top of the keyboard.
403 F17,
404 /// General-purpose function key.
405 /// Usually found at the top of the keyboard.
406 F18,
407 /// General-purpose function key.
408 /// Usually found at the top of the keyboard.
409 F19,
410 /// General-purpose function key.
411 /// Usually found at the top of the keyboard.
412 F20,
413 /// General-purpose function key.
414 /// Usually found at the top of the keyboard.
415 F21,
416 /// General-purpose function key.
417 /// Usually found at the top of the keyboard.
418 F22,
419 /// General-purpose function key.
420 /// Usually found at the top of the keyboard.
421 F23,
422 /// General-purpose function key.
423 /// Usually found at the top of the keyboard.
424 F24,
425 /// General-purpose function key.
426 F25,
427 /// General-purpose function key.
428 F26,
429 /// General-purpose function key.
430 F27,
431 /// General-purpose function key.
432 F28,
433 /// General-purpose function key.
434 F29,
435 /// General-purpose function key.
436 F30,
437 /// General-purpose function key.
438 F31,
439 /// General-purpose function key.
440 F32,
441 /// General-purpose function key.
442 F33,
443 /// General-purpose function key.
444 F34,
445 /// General-purpose function key.
446 F35,
447}