chromiumoxide/
keys.rs

1//! Code based on [rust-headless-chrome](https://github.com/atroche/rust-headless-chrome/blob/master/src/browser/tab/keys.rs)
2
3/// Represents a key on a keyboard
4#[derive(Debug, Default, PartialEq, Eq, Clone, Copy)]
5pub struct KeyDefinition {
6    /// The key value (e.g., "a", "Enter").
7    pub key: &'static str,
8    /// The platform-specific key code.
9    pub key_code: i64,
10    /// The physical key location (e.g., "KeyA", "Digit1").
11    pub code: &'static str,
12    /// The printable text, if applicable.
13    pub text: Option<&'static str>,
14}
15
16//  Generated the following in node using Puppeteer:
17//  keys = require("./lib/USKeyboardLayout.js")
18//  toStruct = (kD) => `KeyDefinition { key: "${kD.key}", key_code:
19// "${kD.keyCode}", code: "${kD.code}", text: kD.text }`  output = Object.
20// values(keys).map(toStruct).join(",\n")  const fs = require('fs');
21//  fs.writeFile("/tmp/blah1", output)
22
23pub const USKEYBOARD_LAYOUT: [KeyDefinition; 244] = [
24    KeyDefinition {
25        key: "0",
26        key_code: 48,
27        code: "Digit0",
28        text: None,
29    },
30    KeyDefinition {
31        key: "1",
32        key_code: 49,
33        code: "Digit1",
34        text: None,
35    },
36    KeyDefinition {
37        key: "2",
38        key_code: 50,
39        code: "Digit2",
40        text: None,
41    },
42    KeyDefinition {
43        key: "3",
44        key_code: 51,
45        code: "Digit3",
46        text: None,
47    },
48    KeyDefinition {
49        key: "4",
50        key_code: 52,
51        code: "Digit4",
52        text: None,
53    },
54    KeyDefinition {
55        key: "5",
56        key_code: 53,
57        code: "Digit5",
58        text: None,
59    },
60    KeyDefinition {
61        key: "6",
62        key_code: 54,
63        code: "Digit6",
64        text: None,
65    },
66    KeyDefinition {
67        key: "7",
68        key_code: 55,
69        code: "Digit7",
70        text: None,
71    },
72    KeyDefinition {
73        key: "8",
74        key_code: 56,
75        code: "Digit8",
76        text: None,
77    },
78    KeyDefinition {
79        key: "9",
80        key_code: 57,
81        code: "Digit9",
82        text: None,
83    },
84    KeyDefinition {
85        key: "Power",
86        key_code: 0,
87        code: "Power",
88        text: None,
89    },
90    KeyDefinition {
91        key: "Eject",
92        key_code: 0,
93        code: "Eject",
94        text: None,
95    },
96    KeyDefinition {
97        key: "Cancel",
98        key_code: 3,
99        code: "Abort",
100        text: None,
101    },
102    KeyDefinition {
103        key: "Help",
104        key_code: 6,
105        code: "Help",
106        text: None,
107    },
108    KeyDefinition {
109        key: "Backspace",
110        key_code: 8,
111        code: "Backspace",
112        text: None,
113    },
114    KeyDefinition {
115        key: "Tab",
116        key_code: 9,
117        code: "Tab",
118        text: None,
119    },
120    KeyDefinition {
121        key: "Clear",
122        key_code: 12,
123        code: "Numpad5",
124        text: None,
125    },
126    KeyDefinition {
127        key: "Enter",
128        key_code: 13,
129        code: "Enter",
130        text: Some("\r"),
131    },
132    KeyDefinition {
133        key: "Shift",
134        key_code: 16,
135        code: "ShiftLeft",
136        text: None,
137    },
138    KeyDefinition {
139        key: "Shift",
140        key_code: 16,
141        code: "ShiftRight",
142        text: None,
143    },
144    KeyDefinition {
145        key: "Control",
146        key_code: 17,
147        code: "ControlLeft",
148        text: None,
149    },
150    KeyDefinition {
151        key: "Control",
152        key_code: 17,
153        code: "ControlRight",
154        text: None,
155    },
156    KeyDefinition {
157        key: "Alt",
158        key_code: 18,
159        code: "AltLeft",
160        text: None,
161    },
162    KeyDefinition {
163        key: "Alt",
164        key_code: 18,
165        code: "AltRight",
166        text: None,
167    },
168    KeyDefinition {
169        key: "Pause",
170        key_code: 19,
171        code: "Pause",
172        text: None,
173    },
174    KeyDefinition {
175        key: "CapsLock",
176        key_code: 20,
177        code: "CapsLock",
178        text: None,
179    },
180    KeyDefinition {
181        key: "Escape",
182        key_code: 27,
183        code: "Escape",
184        text: None,
185    },
186    KeyDefinition {
187        key: "Convert",
188        key_code: 28,
189        code: "Convert",
190        text: None,
191    },
192    KeyDefinition {
193        key: "NonConvert",
194        key_code: 29,
195        code: "NonConvert",
196        text: None,
197    },
198    KeyDefinition {
199        key: " ",
200        key_code: 32,
201        code: "Space",
202        text: None,
203    },
204    KeyDefinition {
205        key: "PageUp",
206        key_code: 33,
207        code: "Numpad9",
208        text: None,
209    },
210    KeyDefinition {
211        key: "PageUp",
212        key_code: 33,
213        code: "PageUp",
214        text: None,
215    },
216    KeyDefinition {
217        key: "PageDown",
218        key_code: 34,
219        code: "Numpad3",
220        text: None,
221    },
222    KeyDefinition {
223        key: "PageDown",
224        key_code: 34,
225        code: "PageDown",
226        text: None,
227    },
228    KeyDefinition {
229        key: "End",
230        key_code: 35,
231        code: "End",
232        text: None,
233    },
234    KeyDefinition {
235        key: "End",
236        key_code: 35,
237        code: "Numpad1",
238        text: None,
239    },
240    KeyDefinition {
241        key: "Home",
242        key_code: 36,
243        code: "Home",
244        text: None,
245    },
246    KeyDefinition {
247        key: "Home",
248        key_code: 36,
249        code: "Numpad7",
250        text: None,
251    },
252    KeyDefinition {
253        key: "ArrowLeft",
254        key_code: 37,
255        code: "ArrowLeft",
256        text: None,
257    },
258    KeyDefinition {
259        key: "ArrowLeft",
260        key_code: 37,
261        code: "Numpad4",
262        text: None,
263    },
264    KeyDefinition {
265        key: "ArrowUp",
266        key_code: 38,
267        code: "Numpad8",
268        text: None,
269    },
270    KeyDefinition {
271        key: "ArrowUp",
272        key_code: 38,
273        code: "ArrowUp",
274        text: None,
275    },
276    KeyDefinition {
277        key: "ArrowRight",
278        key_code: 39,
279        code: "ArrowRight",
280        text: None,
281    },
282    KeyDefinition {
283        key: "ArrowRight",
284        key_code: 39,
285        code: "Numpad6",
286        text: None,
287    },
288    KeyDefinition {
289        key: "ArrowDown",
290        key_code: 40,
291        code: "Numpad2",
292        text: None,
293    },
294    KeyDefinition {
295        key: "ArrowDown",
296        key_code: 40,
297        code: "ArrowDown",
298        text: None,
299    },
300    KeyDefinition {
301        key: "Select",
302        key_code: 41,
303        code: "Select",
304        text: None,
305    },
306    KeyDefinition {
307        key: "Execute",
308        key_code: 43,
309        code: "Open",
310        text: None,
311    },
312    KeyDefinition {
313        key: "PrintScreen",
314        key_code: 44,
315        code: "PrintScreen",
316        text: None,
317    },
318    KeyDefinition {
319        key: "Insert",
320        key_code: 45,
321        code: "Insert",
322        text: None,
323    },
324    KeyDefinition {
325        key: "Insert",
326        key_code: 45,
327        code: "Numpad0",
328        text: None,
329    },
330    KeyDefinition {
331        key: "Delete",
332        key_code: 46,
333        code: "Delete",
334        text: None,
335    },
336    KeyDefinition {
337        key: "",
338        key_code: 46,
339        code: "NumpadDecimal",
340        text: None,
341    },
342    KeyDefinition {
343        key: "0",
344        key_code: 48,
345        code: "Digit0",
346        text: None,
347    },
348    KeyDefinition {
349        key: "1",
350        key_code: 49,
351        code: "Digit1",
352        text: None,
353    },
354    KeyDefinition {
355        key: "2",
356        key_code: 50,
357        code: "Digit2",
358        text: None,
359    },
360    KeyDefinition {
361        key: "3",
362        key_code: 51,
363        code: "Digit3",
364        text: None,
365    },
366    KeyDefinition {
367        key: "4",
368        key_code: 52,
369        code: "Digit4",
370        text: None,
371    },
372    KeyDefinition {
373        key: "5",
374        key_code: 53,
375        code: "Digit5",
376        text: None,
377    },
378    KeyDefinition {
379        key: "6",
380        key_code: 54,
381        code: "Digit6",
382        text: None,
383    },
384    KeyDefinition {
385        key: "7",
386        key_code: 55,
387        code: "Digit7",
388        text: None,
389    },
390    KeyDefinition {
391        key: "8",
392        key_code: 56,
393        code: "Digit8",
394        text: None,
395    },
396    KeyDefinition {
397        key: "9",
398        key_code: 57,
399        code: "Digit9",
400        text: None,
401    },
402    KeyDefinition {
403        key: "a",
404        key_code: 65,
405        code: "KeyA",
406        text: None,
407    },
408    KeyDefinition {
409        key: "b",
410        key_code: 66,
411        code: "KeyB",
412        text: None,
413    },
414    KeyDefinition {
415        key: "c",
416        key_code: 67,
417        code: "KeyC",
418        text: None,
419    },
420    KeyDefinition {
421        key: "d",
422        key_code: 68,
423        code: "KeyD",
424        text: None,
425    },
426    KeyDefinition {
427        key: "e",
428        key_code: 69,
429        code: "KeyE",
430        text: None,
431    },
432    KeyDefinition {
433        key: "f",
434        key_code: 70,
435        code: "KeyF",
436        text: None,
437    },
438    KeyDefinition {
439        key: "g",
440        key_code: 71,
441        code: "KeyG",
442        text: None,
443    },
444    KeyDefinition {
445        key: "h",
446        key_code: 72,
447        code: "KeyH",
448        text: None,
449    },
450    KeyDefinition {
451        key: "i",
452        key_code: 73,
453        code: "KeyI",
454        text: None,
455    },
456    KeyDefinition {
457        key: "j",
458        key_code: 74,
459        code: "KeyJ",
460        text: None,
461    },
462    KeyDefinition {
463        key: "k",
464        key_code: 75,
465        code: "KeyK",
466        text: None,
467    },
468    KeyDefinition {
469        key: "l",
470        key_code: 76,
471        code: "KeyL",
472        text: None,
473    },
474    KeyDefinition {
475        key: "m",
476        key_code: 77,
477        code: "KeyM",
478        text: None,
479    },
480    KeyDefinition {
481        key: "n",
482        key_code: 78,
483        code: "KeyN",
484        text: None,
485    },
486    KeyDefinition {
487        key: "o",
488        key_code: 79,
489        code: "KeyO",
490        text: None,
491    },
492    KeyDefinition {
493        key: "p",
494        key_code: 80,
495        code: "KeyP",
496        text: None,
497    },
498    KeyDefinition {
499        key: "q",
500        key_code: 81,
501        code: "KeyQ",
502        text: None,
503    },
504    KeyDefinition {
505        key: "r",
506        key_code: 82,
507        code: "KeyR",
508        text: None,
509    },
510    KeyDefinition {
511        key: "s",
512        key_code: 83,
513        code: "KeyS",
514        text: None,
515    },
516    KeyDefinition {
517        key: "t",
518        key_code: 84,
519        code: "KeyT",
520        text: None,
521    },
522    KeyDefinition {
523        key: "u",
524        key_code: 85,
525        code: "KeyU",
526        text: None,
527    },
528    KeyDefinition {
529        key: "v",
530        key_code: 86,
531        code: "KeyV",
532        text: None,
533    },
534    KeyDefinition {
535        key: "w",
536        key_code: 87,
537        code: "KeyW",
538        text: None,
539    },
540    KeyDefinition {
541        key: "x",
542        key_code: 88,
543        code: "KeyX",
544        text: None,
545    },
546    KeyDefinition {
547        key: "y",
548        key_code: 89,
549        code: "KeyY",
550        text: None,
551    },
552    KeyDefinition {
553        key: "z",
554        key_code: 90,
555        code: "KeyZ",
556        text: None,
557    },
558    KeyDefinition {
559        key: "Meta",
560        key_code: 91,
561        code: "MetaLeft",
562        text: None,
563    },
564    KeyDefinition {
565        key: "Meta",
566        key_code: 92,
567        code: "MetaRight",
568        text: None,
569    },
570    KeyDefinition {
571        key: "ContextMenu",
572        key_code: 93,
573        code: "ContextMenu",
574        text: None,
575    },
576    KeyDefinition {
577        key: "*",
578        key_code: 106,
579        code: "NumpadMultiply",
580        text: None,
581    },
582    KeyDefinition {
583        key: "+",
584        key_code: 107,
585        code: "NumpadAdd",
586        text: None,
587    },
588    KeyDefinition {
589        key: "-",
590        key_code: 109,
591        code: "NumpadSubtract",
592        text: None,
593    },
594    KeyDefinition {
595        key: "/",
596        key_code: 111,
597        code: "NumpadDivide",
598        text: None,
599    },
600    KeyDefinition {
601        key: "F1",
602        key_code: 112,
603        code: "F1",
604        text: None,
605    },
606    KeyDefinition {
607        key: "F2",
608        key_code: 113,
609        code: "F2",
610        text: None,
611    },
612    KeyDefinition {
613        key: "F3",
614        key_code: 114,
615        code: "F3",
616        text: None,
617    },
618    KeyDefinition {
619        key: "F4",
620        key_code: 115,
621        code: "F4",
622        text: None,
623    },
624    KeyDefinition {
625        key: "F5",
626        key_code: 116,
627        code: "F5",
628        text: None,
629    },
630    KeyDefinition {
631        key: "F6",
632        key_code: 117,
633        code: "F6",
634        text: None,
635    },
636    KeyDefinition {
637        key: "F7",
638        key_code: 118,
639        code: "F7",
640        text: None,
641    },
642    KeyDefinition {
643        key: "F8",
644        key_code: 119,
645        code: "F8",
646        text: None,
647    },
648    KeyDefinition {
649        key: "F9",
650        key_code: 120,
651        code: "F9",
652        text: None,
653    },
654    KeyDefinition {
655        key: "F10",
656        key_code: 121,
657        code: "F10",
658        text: None,
659    },
660    KeyDefinition {
661        key: "F11",
662        key_code: 122,
663        code: "F11",
664        text: None,
665    },
666    KeyDefinition {
667        key: "F12",
668        key_code: 123,
669        code: "F12",
670        text: None,
671    },
672    KeyDefinition {
673        key: "F13",
674        key_code: 124,
675        code: "F13",
676        text: None,
677    },
678    KeyDefinition {
679        key: "F14",
680        key_code: 125,
681        code: "F14",
682        text: None,
683    },
684    KeyDefinition {
685        key: "F15",
686        key_code: 126,
687        code: "F15",
688        text: None,
689    },
690    KeyDefinition {
691        key: "F16",
692        key_code: 127,
693        code: "F16",
694        text: None,
695    },
696    KeyDefinition {
697        key: "F17",
698        key_code: 128,
699        code: "F17",
700        text: None,
701    },
702    KeyDefinition {
703        key: "F18",
704        key_code: 129,
705        code: "F18",
706        text: None,
707    },
708    KeyDefinition {
709        key: "F19",
710        key_code: 130,
711        code: "F19",
712        text: None,
713    },
714    KeyDefinition {
715        key: "F20",
716        key_code: 131,
717        code: "F20",
718        text: None,
719    },
720    KeyDefinition {
721        key: "F21",
722        key_code: 132,
723        code: "F21",
724        text: None,
725    },
726    KeyDefinition {
727        key: "F22",
728        key_code: 133,
729        code: "F22",
730        text: None,
731    },
732    KeyDefinition {
733        key: "F23",
734        key_code: 134,
735        code: "F23",
736        text: None,
737    },
738    KeyDefinition {
739        key: "F24",
740        key_code: 135,
741        code: "F24",
742        text: None,
743    },
744    KeyDefinition {
745        key: "NumLock",
746        key_code: 144,
747        code: "NumLock",
748        text: None,
749    },
750    KeyDefinition {
751        key: "ScrollLock",
752        key_code: 145,
753        code: "ScrollLock",
754        text: None,
755    },
756    KeyDefinition {
757        key: "AudioVolumeMute",
758        key_code: 173,
759        code: "AudioVolumeMute",
760        text: None,
761    },
762    KeyDefinition {
763        key: "AudioVolumeDown",
764        key_code: 174,
765        code: "AudioVolumeDown",
766        text: None,
767    },
768    KeyDefinition {
769        key: "AudioVolumeUp",
770        key_code: 175,
771        code: "AudioVolumeUp",
772        text: None,
773    },
774    KeyDefinition {
775        key: "MediaTrackNext",
776        key_code: 176,
777        code: "MediaTrackNext",
778        text: None,
779    },
780    KeyDefinition {
781        key: "MediaTrackPrevious",
782        key_code: 177,
783        code: "MediaTrackPrevious",
784        text: None,
785    },
786    KeyDefinition {
787        key: "MediaStop",
788        key_code: 178,
789        code: "MediaStop",
790        text: None,
791    },
792    KeyDefinition {
793        key: "MediaPlayPause",
794        key_code: 179,
795        code: "MediaPlayPause",
796        text: None,
797    },
798    KeyDefinition {
799        key: ";",
800        key_code: 186,
801        code: "Semicolon",
802        text: None,
803    },
804    KeyDefinition {
805        key: "=",
806        key_code: 187,
807        code: "Equal",
808        text: None,
809    },
810    KeyDefinition {
811        key: "=",
812        key_code: 187,
813        code: "NumpadEqual",
814        text: None,
815    },
816    KeyDefinition {
817        key: ",",
818        key_code: 188,
819        code: "Comma",
820        text: None,
821    },
822    KeyDefinition {
823        key: "-",
824        key_code: 189,
825        code: "Minus",
826        text: None,
827    },
828    KeyDefinition {
829        key: ".",
830        key_code: 190,
831        code: "Period",
832        text: None,
833    },
834    KeyDefinition {
835        key: "/",
836        key_code: 191,
837        code: "Slash",
838        text: None,
839    },
840    KeyDefinition {
841        key: "`",
842        key_code: 192,
843        code: "Backquote",
844        text: None,
845    },
846    KeyDefinition {
847        key: "[",
848        key_code: 219,
849        code: "BracketLeft",
850        text: None,
851    },
852    KeyDefinition {
853        key: "\\",
854        key_code: 220,
855        code: "Backslash",
856        text: None,
857    },
858    KeyDefinition {
859        key: "]",
860        key_code: 221,
861        code: "BracketRight",
862        text: None,
863    },
864    KeyDefinition {
865        key: "'",
866        key_code: 222,
867        code: "Quote",
868        text: None,
869    },
870    KeyDefinition {
871        key: "AltGraph",
872        key_code: 225,
873        code: "AltGraph",
874        text: None,
875    },
876    KeyDefinition {
877        key: "CrSel",
878        key_code: 247,
879        code: "Props",
880        text: None,
881    },
882    KeyDefinition {
883        key: "Cancel",
884        key_code: 3,
885        code: "Abort",
886        text: None,
887    },
888    KeyDefinition {
889        key: "Clear",
890        key_code: 12,
891        code: "Numpad5",
892        text: None,
893    },
894    KeyDefinition {
895        key: "Shift",
896        key_code: 16,
897        code: "ShiftLeft",
898        text: None,
899    },
900    KeyDefinition {
901        key: "Control",
902        key_code: 17,
903        code: "ControlLeft",
904        text: None,
905    },
906    KeyDefinition {
907        key: "Alt",
908        key_code: 18,
909        code: "AltLeft",
910        text: None,
911    },
912    KeyDefinition {
913        key: "Accept",
914        key_code: 30,
915        code: "undefined",
916        text: None,
917    },
918    KeyDefinition {
919        key: "ModeChange",
920        key_code: 31,
921        code: "undefined",
922        text: None,
923    },
924    KeyDefinition {
925        key: " ",
926        key_code: 32,
927        code: "Space",
928        text: None,
929    },
930    KeyDefinition {
931        key: "Print",
932        key_code: 42,
933        code: "undefined",
934        text: None,
935    },
936    KeyDefinition {
937        key: "Execute",
938        key_code: 43,
939        code: "Open",
940        text: None,
941    },
942    KeyDefinition {
943        key: "",
944        key_code: 46,
945        code: "NumpadDecimal",
946        text: None,
947    },
948    KeyDefinition {
949        key: "a",
950        key_code: 65,
951        code: "KeyA",
952        text: None,
953    },
954    KeyDefinition {
955        key: "b",
956        key_code: 66,
957        code: "KeyB",
958        text: None,
959    },
960    KeyDefinition {
961        key: "c",
962        key_code: 67,
963        code: "KeyC",
964        text: None,
965    },
966    KeyDefinition {
967        key: "d",
968        key_code: 68,
969        code: "KeyD",
970        text: None,
971    },
972    KeyDefinition {
973        key: "e",
974        key_code: 69,
975        code: "KeyE",
976        text: None,
977    },
978    KeyDefinition {
979        key: "f",
980        key_code: 70,
981        code: "KeyF",
982        text: None,
983    },
984    KeyDefinition {
985        key: "g",
986        key_code: 71,
987        code: "KeyG",
988        text: None,
989    },
990    KeyDefinition {
991        key: "h",
992        key_code: 72,
993        code: "KeyH",
994        text: None,
995    },
996    KeyDefinition {
997        key: "i",
998        key_code: 73,
999        code: "KeyI",
1000        text: None,
1001    },
1002    KeyDefinition {
1003        key: "j",
1004        key_code: 74,
1005        code: "KeyJ",
1006        text: None,
1007    },
1008    KeyDefinition {
1009        key: "k",
1010        key_code: 75,
1011        code: "KeyK",
1012        text: None,
1013    },
1014    KeyDefinition {
1015        key: "l",
1016        key_code: 76,
1017        code: "KeyL",
1018        text: None,
1019    },
1020    KeyDefinition {
1021        key: "m",
1022        key_code: 77,
1023        code: "KeyM",
1024        text: None,
1025    },
1026    KeyDefinition {
1027        key: "n",
1028        key_code: 78,
1029        code: "KeyN",
1030        text: None,
1031    },
1032    KeyDefinition {
1033        key: "o",
1034        key_code: 79,
1035        code: "KeyO",
1036        text: None,
1037    },
1038    KeyDefinition {
1039        key: "p",
1040        key_code: 80,
1041        code: "KeyP",
1042        text: None,
1043    },
1044    KeyDefinition {
1045        key: "q",
1046        key_code: 81,
1047        code: "KeyQ",
1048        text: None,
1049    },
1050    KeyDefinition {
1051        key: "r",
1052        key_code: 82,
1053        code: "KeyR",
1054        text: None,
1055    },
1056    KeyDefinition {
1057        key: "s",
1058        key_code: 83,
1059        code: "KeyS",
1060        text: None,
1061    },
1062    KeyDefinition {
1063        key: "t",
1064        key_code: 84,
1065        code: "KeyT",
1066        text: None,
1067    },
1068    KeyDefinition {
1069        key: "u",
1070        key_code: 85,
1071        code: "KeyU",
1072        text: None,
1073    },
1074    KeyDefinition {
1075        key: "v",
1076        key_code: 86,
1077        code: "KeyV",
1078        text: None,
1079    },
1080    KeyDefinition {
1081        key: "w",
1082        key_code: 87,
1083        code: "KeyW",
1084        text: None,
1085    },
1086    KeyDefinition {
1087        key: "x",
1088        key_code: 88,
1089        code: "KeyX",
1090        text: None,
1091    },
1092    KeyDefinition {
1093        key: "y",
1094        key_code: 89,
1095        code: "KeyY",
1096        text: None,
1097    },
1098    KeyDefinition {
1099        key: "z",
1100        key_code: 90,
1101        code: "KeyZ",
1102        text: None,
1103    },
1104    KeyDefinition {
1105        key: "Meta",
1106        key_code: 91,
1107        code: "MetaLeft",
1108        text: None,
1109    },
1110    KeyDefinition {
1111        key: "*",
1112        key_code: 106,
1113        code: "NumpadMultiply",
1114        text: None,
1115    },
1116    KeyDefinition {
1117        key: "+",
1118        key_code: 107,
1119        code: "NumpadAdd",
1120        text: None,
1121    },
1122    KeyDefinition {
1123        key: "-",
1124        key_code: 109,
1125        code: "NumpadSubtract",
1126        text: None,
1127    },
1128    KeyDefinition {
1129        key: "/",
1130        key_code: 111,
1131        code: "NumpadDivide",
1132        text: None,
1133    },
1134    KeyDefinition {
1135        key: ";",
1136        key_code: 186,
1137        code: "Semicolon",
1138        text: None,
1139    },
1140    KeyDefinition {
1141        key: "=",
1142        key_code: 187,
1143        code: "Equal",
1144        text: None,
1145    },
1146    KeyDefinition {
1147        key: ",",
1148        key_code: 188,
1149        code: "Comma",
1150        text: None,
1151    },
1152    KeyDefinition {
1153        key: ".",
1154        key_code: 190,
1155        code: "Period",
1156        text: None,
1157    },
1158    KeyDefinition {
1159        key: "`",
1160        key_code: 192,
1161        code: "Backquote",
1162        text: None,
1163    },
1164    KeyDefinition {
1165        key: "[",
1166        key_code: 219,
1167        code: "BracketLeft",
1168        text: None,
1169    },
1170    KeyDefinition {
1171        key: "]",
1172        key_code: 221,
1173        code: "BracketRight",
1174        text: None,
1175    },
1176    KeyDefinition {
1177        key: "'",
1178        key_code: 222,
1179        code: "Quote",
1180        text: None,
1181    },
1182    KeyDefinition {
1183        key: "Attn",
1184        key_code: 246,
1185        code: "undefined",
1186        text: None,
1187    },
1188    KeyDefinition {
1189        key: "CrSel",
1190        key_code: 247,
1191        code: "Props",
1192        text: None,
1193    },
1194    KeyDefinition {
1195        key: "ExSel",
1196        key_code: 248,
1197        code: "undefined",
1198        text: None,
1199    },
1200    KeyDefinition {
1201        key: "EraseEof",
1202        key_code: 249,
1203        code: "undefined",
1204        text: None,
1205    },
1206    KeyDefinition {
1207        key: "Play",
1208        key_code: 250,
1209        code: "undefined",
1210        text: None,
1211    },
1212    KeyDefinition {
1213        key: "ZoomOut",
1214        key_code: 251,
1215        code: "undefined",
1216        text: None,
1217    },
1218    KeyDefinition {
1219        key: ")",
1220        key_code: 48,
1221        code: "Digit0",
1222        text: None,
1223    },
1224    KeyDefinition {
1225        key: "!",
1226        key_code: 49,
1227        code: "Digit1",
1228        text: None,
1229    },
1230    KeyDefinition {
1231        key: "@",
1232        key_code: 50,
1233        code: "Digit2",
1234        text: None,
1235    },
1236    KeyDefinition {
1237        key: "#",
1238        key_code: 51,
1239        code: "Digit3",
1240        text: None,
1241    },
1242    KeyDefinition {
1243        key: "$",
1244        key_code: 52,
1245        code: "Digit4",
1246        text: None,
1247    },
1248    KeyDefinition {
1249        key: "%",
1250        key_code: 53,
1251        code: "Digit5",
1252        text: None,
1253    },
1254    KeyDefinition {
1255        key: "^",
1256        key_code: 54,
1257        code: "Digit6",
1258        text: None,
1259    },
1260    KeyDefinition {
1261        key: "&",
1262        key_code: 55,
1263        code: "Digit7",
1264        text: None,
1265    },
1266    KeyDefinition {
1267        key: "(",
1268        key_code: 57,
1269        code: "Digit9",
1270        text: None,
1271    },
1272    KeyDefinition {
1273        key: "A",
1274        key_code: 65,
1275        code: "KeyA",
1276        text: None,
1277    },
1278    KeyDefinition {
1279        key: "B",
1280        key_code: 66,
1281        code: "KeyB",
1282        text: None,
1283    },
1284    KeyDefinition {
1285        key: "C",
1286        key_code: 67,
1287        code: "KeyC",
1288        text: None,
1289    },
1290    KeyDefinition {
1291        key: "D",
1292        key_code: 68,
1293        code: "KeyD",
1294        text: None,
1295    },
1296    KeyDefinition {
1297        key: "E",
1298        key_code: 69,
1299        code: "KeyE",
1300        text: None,
1301    },
1302    KeyDefinition {
1303        key: "F",
1304        key_code: 70,
1305        code: "KeyF",
1306        text: None,
1307    },
1308    KeyDefinition {
1309        key: "G",
1310        key_code: 71,
1311        code: "KeyG",
1312        text: None,
1313    },
1314    KeyDefinition {
1315        key: "H",
1316        key_code: 72,
1317        code: "KeyH",
1318        text: None,
1319    },
1320    KeyDefinition {
1321        key: "I",
1322        key_code: 73,
1323        code: "KeyI",
1324        text: None,
1325    },
1326    KeyDefinition {
1327        key: "J",
1328        key_code: 74,
1329        code: "KeyJ",
1330        text: None,
1331    },
1332    KeyDefinition {
1333        key: "K",
1334        key_code: 75,
1335        code: "KeyK",
1336        text: None,
1337    },
1338    KeyDefinition {
1339        key: "L",
1340        key_code: 76,
1341        code: "KeyL",
1342        text: None,
1343    },
1344    KeyDefinition {
1345        key: "M",
1346        key_code: 77,
1347        code: "KeyM",
1348        text: None,
1349    },
1350    KeyDefinition {
1351        key: "N",
1352        key_code: 78,
1353        code: "KeyN",
1354        text: None,
1355    },
1356    KeyDefinition {
1357        key: "O",
1358        key_code: 79,
1359        code: "KeyO",
1360        text: None,
1361    },
1362    KeyDefinition {
1363        key: "P",
1364        key_code: 80,
1365        code: "KeyP",
1366        text: None,
1367    },
1368    KeyDefinition {
1369        key: "Q",
1370        key_code: 81,
1371        code: "KeyQ",
1372        text: None,
1373    },
1374    KeyDefinition {
1375        key: "R",
1376        key_code: 82,
1377        code: "KeyR",
1378        text: None,
1379    },
1380    KeyDefinition {
1381        key: "S",
1382        key_code: 83,
1383        code: "KeyS",
1384        text: None,
1385    },
1386    KeyDefinition {
1387        key: "T",
1388        key_code: 84,
1389        code: "KeyT",
1390        text: None,
1391    },
1392    KeyDefinition {
1393        key: "U",
1394        key_code: 85,
1395        code: "KeyU",
1396        text: None,
1397    },
1398    KeyDefinition {
1399        key: "V",
1400        key_code: 86,
1401        code: "KeyV",
1402        text: None,
1403    },
1404    KeyDefinition {
1405        key: "W",
1406        key_code: 87,
1407        code: "KeyW",
1408        text: None,
1409    },
1410    KeyDefinition {
1411        key: "X",
1412        key_code: 88,
1413        code: "KeyX",
1414        text: None,
1415    },
1416    KeyDefinition {
1417        key: "Y",
1418        key_code: 89,
1419        code: "KeyY",
1420        text: None,
1421    },
1422    KeyDefinition {
1423        key: "Z",
1424        key_code: 90,
1425        code: "KeyZ",
1426        text: None,
1427    },
1428    KeyDefinition {
1429        key: ":",
1430        key_code: 186,
1431        code: "Semicolon",
1432        text: None,
1433    },
1434    KeyDefinition {
1435        key: "<",
1436        key_code: 188,
1437        code: "Comma",
1438        text: None,
1439    },
1440    KeyDefinition {
1441        key: "_",
1442        key_code: 189,
1443        code: "Minus",
1444        text: None,
1445    },
1446    KeyDefinition {
1447        key: ">",
1448        key_code: 190,
1449        code: "Period",
1450        text: None,
1451    },
1452    KeyDefinition {
1453        key: "?",
1454        key_code: 191,
1455        code: "Slash",
1456        text: None,
1457    },
1458    KeyDefinition {
1459        key: "~",
1460        key_code: 192,
1461        code: "Backquote",
1462        text: None,
1463    },
1464    KeyDefinition {
1465        key: "{",
1466        key_code: 219,
1467        code: "BracketLeft",
1468        text: None,
1469    },
1470    KeyDefinition {
1471        key: "|",
1472        key_code: 220,
1473        code: "Backslash",
1474        text: None,
1475    },
1476    KeyDefinition {
1477        key: "}",
1478        key_code: 221,
1479        code: "BracketRight",
1480        text: None,
1481    },
1482    KeyDefinition {
1483        key: "\"",
1484        key_code: 222,
1485        code: "Quote",
1486        text: None,
1487    },
1488];
1489
1490/// Returns the `KeyDefinition` by key name
1491/// # Example return the `Enter` key: `get_key_definition("Enter").unwrap()`
1492pub fn get_key_definition(key: impl AsRef<str>) -> Option<&'static KeyDefinition> {
1493    let key = key.as_ref();
1494    USKEYBOARD_LAYOUT
1495        .iter()
1496        .find(|key_definition| key_definition.key == key)
1497}