Skip to content

Commit a5c8628

Browse files
authored
fix: add missed keycodes for hotkeys (#197)
1 parent e48b004 commit a5c8628

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

src/config.rs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,58 @@ impl Hotkey {
225225
};
226226
// see <https://kbdlayout.info/kbdus/overview+scancodes>
227227
let code = match keys[1] {
228+
"esc" | "escape" => 0x01,
229+
"1" | "!" => 0x02,
230+
"2" | "@" => 0x03,
231+
"3" | "#" => 0x04,
232+
"4" | "$" => 0x05,
233+
"5" | "%" => 0x06,
234+
"6" | "^" => 0x07,
235+
"7" | "&" => 0x08,
236+
"8" | "*" => 0x09,
237+
"9" | "(" => 0x0a,
238+
"0" | ")" => 0x0b,
228239
"-" | "_" | "oem_minus" => 0x0c,
229240
"+" | "=" | "oem_plus" => 0x0d,
230241
"bs" | "backspace" => 0x0e,
231242
"tab" => 0x0f,
243+
"q" => 0x10,
244+
"w" => 0x11,
245+
"e" => 0x12,
246+
"r" => 0x13,
247+
"t" => 0x14,
248+
"y" => 0x15,
249+
"u" => 0x16,
250+
"i" => 0x17,
251+
"o" => 0x18,
252+
"p" => 0x19,
232253
"{" | "[" | "oem_4" => 0x1a,
233254
"}" | "]" | "oem_6" => 0x1b,
255+
"enter" | "return" => 0x1c,
256+
"a" => 0x1e,
257+
"s" => 0x1f,
258+
"d" => 0x20,
259+
"f" => 0x21,
260+
"g" => 0x22,
261+
"h" => 0x23,
262+
"j" => 0x24,
263+
"k" => 0x25,
264+
"l" => 0x26,
234265
":" | ";" | "oem_1" => 0x27,
235266
"\"" | "'" | "oem_7" => 0x28,
236267
"~" | "`" | "oem_3" => 0x29,
237268
"|" | "\\" | "oem_5" => 0x2b,
269+
"z" => 0x2c,
270+
"x" => 0x2d,
271+
"c" => 0x2e,
272+
"v" => 0x2f,
273+
"b" => 0x30,
274+
"n" => 0x31,
275+
"m" => 0x32,
238276
"<" | "," | "oem_comma" => 0x33,
239277
">" | "." | "oem_period" => 0x34,
240278
"?" | "/" | "oem_2" => 0x35,
279+
"space" => 0x39,
241280
"capslock" => 0x3a,
242281
"f1" => 0x3b,
243282
"f2" => 0x3c,
@@ -249,11 +288,8 @@ impl Hotkey {
249288
"f8" => 0x42,
250289
"f9" => 0x43,
251290
"f10" => 0x44,
291+
"numlock" => 0x45,
252292
"scrolllock" => 0x46,
253-
"prtsc" | "printscreen" => 0x54,
254-
"oem_102" => 0x56,
255-
"f11" => 0x57,
256-
"f12" => 0x58,
257293
"home" => 0x47,
258294
"up" => 0x48,
259295
"pageup" => 0x49,
@@ -264,6 +300,10 @@ impl Hotkey {
264300
"pagedown" => 0x51,
265301
"insert" => 0x52,
266302
"delete" => 0x53,
303+
"prtsc" | "printscreen" => 0x54,
304+
"oem_102" => 0x56,
305+
"f11" => 0x57,
306+
"f12" => 0x58,
267307
"menu" => 0x5d,
268308
_ => return None,
269309
};

0 commit comments

Comments
 (0)