1-
2-
31pub fn mouse_to_engin ( key : u8 ) -> Option < enigo:: Button > {
42 match key {
5- 0 => Some ( enigo:: Button :: Left ) ,
6- 1 => Some ( enigo:: Button :: Middle ) ,
7- 2 => Some ( enigo:: Button :: Right ) ,
3+ 233 => Some ( enigo:: Button :: Left ) ,
4+ 235 => Some ( enigo:: Button :: Right ) ,
85 _ => None ,
96 }
107}
118
129pub fn key_to_enigo ( key : u8 ) -> Option < enigo:: Key > {
1310 match key {
1411 27 => Some ( enigo:: Key :: Escape ) ,
15- 112 => Some ( enigo:: Key :: F1 ) ,
16- 113 => Some ( enigo:: Key :: F2 ) ,
17- 114 => Some ( enigo:: Key :: F3 ) ,
18- 115 => Some ( enigo:: Key :: F4 ) ,
19- 116 => Some ( enigo:: Key :: F5 ) ,
20- 117 => Some ( enigo:: Key :: F6 ) ,
21- 118 => Some ( enigo:: Key :: F7 ) ,
22- 119 => Some ( enigo:: Key :: F8 ) ,
23- 120 => Some ( enigo:: Key :: F9 ) ,
24- 121 => Some ( enigo:: Key :: F10 ) ,
25- 122 => Some ( enigo:: Key :: F11 ) ,
26- 123 => Some ( enigo:: Key :: F12 ) ,
12+ 190 => Some ( enigo:: Key :: F1 ) ,
13+ 191 => Some ( enigo:: Key :: F2 ) ,
14+ 192 => Some ( enigo:: Key :: F3 ) ,
15+ 193 => Some ( enigo:: Key :: F4 ) ,
16+ 194 => Some ( enigo:: Key :: F5 ) ,
17+ 195 => Some ( enigo:: Key :: F6 ) ,
18+ 196 => Some ( enigo:: Key :: F7 ) ,
19+ 197 => Some ( enigo:: Key :: F8 ) ,
20+ 198 => Some ( enigo:: Key :: F9 ) ,
21+ 199 => Some ( enigo:: Key :: F10 ) ,
22+ 200 => Some ( enigo:: Key :: F11 ) ,
23+ 201 => Some ( enigo:: Key :: F12 ) ,
2724 // 19 => Some(enigo::Key::Pause), // Pause
2825 // 97 => Some(enigo::Key::Print), // Print
29- 46 => Some ( enigo:: Key :: Delete ) ,
30- 35 => Some ( enigo:: Key :: End ) ,
31- 192 => Some ( enigo:: Key :: Unicode ( '`' ) ) ,
26+ 255 => Some ( enigo:: Key :: Delete ) ,
27+ 87 => Some ( enigo:: Key :: End ) ,
28+ 96 => Some ( enigo:: Key :: Unicode ( '`' ) ) ,
3229 48 => Some ( enigo:: Key :: Unicode ( '0' ) ) ,
3330 49 => Some ( enigo:: Key :: Unicode ( '1' ) ) ,
3431 50 => Some ( enigo:: Key :: Unicode ( '2' ) ) ,
@@ -39,37 +36,37 @@ pub fn key_to_enigo(key: u8) -> Option<enigo::Key> {
3936 55 => Some ( enigo:: Key :: Unicode ( '7' ) ) ,
4037 56 => Some ( enigo:: Key :: Unicode ( '8' ) ) ,
4138 57 => Some ( enigo:: Key :: Unicode ( '9' ) ) ,
42- 189 => Some ( enigo:: Key :: Unicode ( '-' ) ) ,
43- 187 => Some ( enigo:: Key :: Unicode ( '=' ) ) ,
39+ 45 => Some ( enigo:: Key :: Unicode ( '-' ) ) ,
40+ 61 => Some ( enigo:: Key :: Unicode ( '=' ) ) ,
4441 8 => Some ( enigo:: Key :: Backspace ) ,
4542 9 => Some ( enigo:: Key :: Tab ) ,
46- 219 => Some ( enigo:: Key :: Unicode ( '[' ) ) ,
47- 221 => Some ( enigo:: Key :: Unicode ( ']' ) ) ,
48- 220 => Some ( enigo:: Key :: Unicode ( '\\' ) ) ,
49- 20 => Some ( enigo:: Key :: CapsLock ) ,
50- 186 => Some ( enigo:: Key :: Unicode ( ';' ) ) ,
51- 222 => Some ( enigo:: Key :: Unicode ( '\'' ) ) ,
43+ 91 => Some ( enigo:: Key :: Unicode ( '[' ) ) ,
44+ 93 => Some ( enigo:: Key :: Unicode ( ']' ) ) ,
45+ 92 => Some ( enigo:: Key :: Unicode ( '\\' ) ) ,
46+ 229 => Some ( enigo:: Key :: CapsLock ) ,
47+ 59 => Some ( enigo:: Key :: Unicode ( ';' ) ) ,
48+ 39 => Some ( enigo:: Key :: Unicode ( '\'' ) ) ,
5249 13 => Some ( enigo:: Key :: Return ) ,
53- 16 => Some ( enigo:: Key :: Shift ) , // ShiftL
54- 188 => Some ( enigo:: Key :: Unicode ( ',' ) ) ,
55- 190 => Some ( enigo:: Key :: Unicode ( '.' ) ) ,
56- 191 => Some ( enigo:: Key :: Unicode ( '/' ) ) ,
57- 161 => Some ( enigo:: Key :: Shift ) , // ShiftR
58- 38 => Some ( enigo:: Key :: UpArrow ) ,
59- 17 => Some ( enigo:: Key :: Control ) , // ControlL
60- 18 => Some ( enigo:: Key :: Alt ) , // AltL
50+ 225 => Some ( enigo:: Key :: Shift ) , // ShiftL
51+ 44 => Some ( enigo:: Key :: Unicode ( ',' ) ) ,
52+ 46 => Some ( enigo:: Key :: Unicode ( '.' ) ) ,
53+ 47 => Some ( enigo:: Key :: Unicode ( '/' ) ) ,
54+ 226 => Some ( enigo:: Key :: Shift ) , // ShiftR
55+ 82 => Some ( enigo:: Key :: UpArrow ) ,
56+ 227 => Some ( enigo:: Key :: Control ) , // ControlL
57+ 233 => Some ( enigo:: Key :: Alt ) , // AltL
6158 32 => Some ( enigo:: Key :: Space ) ,
62- 165 => Some ( enigo:: Key :: Alt ) , // AltR
59+ 234 => Some ( enigo:: Key :: Alt ) , // AltR
6360 // 103 => Some(enigo::Key::Menu),
64- 163 => Some ( enigo:: Key :: Control ) , // ControlR
65- 37 => Some ( enigo:: Key :: LeftArrow ) ,
66- 40 => Some ( enigo:: Key :: DownArrow ) ,
67- 39 => Some ( enigo:: Key :: RightArrow ) ,
61+ 228 => Some ( enigo:: Key :: Control ) , // ControlR
62+ 81 => Some ( enigo:: Key :: LeftArrow ) ,
63+ 84 => Some ( enigo:: Key :: DownArrow ) ,
64+ 83 => Some ( enigo:: Key :: RightArrow ) ,
6865 // 99 => Some(enigo::Key::Raw(45)), // Insert
69- 34 => Some ( enigo:: Key :: PageDown ) ,
70- 36 => Some ( enigo:: Key :: Home ) ,
71- 33 => Some ( enigo:: Key :: PageUp ) ,
72- a if a >= 65 && a <= 90 => Some ( enigo:: Key :: Unicode ( ( a - 65 + ( 'a' as u8 ) ) as char ) ) ,
66+ 86 => Some ( enigo:: Key :: PageDown ) ,
67+ 80 => Some ( enigo:: Key :: Home ) ,
68+ 85 => Some ( enigo:: Key :: PageUp ) ,
69+ a if a >= 97 && a <= 122 => Some ( enigo:: Key :: Unicode ( ( a - 97 + ( 'a' as u8 ) ) as char ) ) ,
7370 _ => None ,
7471 }
7572}
0 commit comments