@@ -126,6 +126,7 @@ key events. In this case `keyboard` will be unable to report events.
126126- [ keyboard.** add\_ word\_ listener** ] ( #keyboard.add_word_listener ) * (aliases: ` register_word_listener ` )*
127127- [ keyboard.** remove\_ word\_ listener** ] ( #keyboard.remove_word_listener ) * (aliases: ` remove_abbreviation ` )*
128128- [ keyboard.** add\_ abbreviation** ] ( #keyboard.add_abbreviation ) * (aliases: ` register_abbreviation ` )*
129+ - [ keyboard.** normalize\_ name** ] ( #keyboard.normalize_name )
129130
130131
131132<a name =" keyboard.KEY_DOWN " />
@@ -224,7 +225,7 @@ Returns True if `key` is a scan code or name of a modifier key.
224225
225226## keyboard.** key\_ to\_ scan\_ codes** (key, error\_ if\_ missing=True)
226227
227- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L300 )
228+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L296 )
228229
229230
230231Returns a list of scan codes associated with this key (name or scan code).
@@ -235,7 +236,7 @@ Returns a list of scan codes associated with this key (name or scan code).
235236
236237## keyboard.** parse\_ hotkey** (hotkey)
237238
238- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L330 )
239+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L326 )
239240
240241
241242Parses a user-provided hotkey into nested tuples representing the
@@ -260,7 +261,7 @@ parse_hotkey("alt+shift+a, alt+b, c")
260261
261262## keyboard.** send** (hotkey, do\_ press=True, do\_ release=True)
262263
263- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L363 )
264+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L359 )
264265
265266
266267Sends OS events that perform the given * hotkey* hotkey.
@@ -286,7 +287,7 @@ Note: keys are released in the opposite order they were pressed.
286287
287288## keyboard.** press** (hotkey)
288289
289- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L396 )
290+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L392 )
290291
291292Presses and holds down a hotkey (see [ ` send ` ] ( #keyboard.send ) ).
292293
@@ -295,7 +296,7 @@ Presses and holds down a hotkey (see [`send`](#keyboard.send)).
295296
296297## keyboard.** release** (hotkey)
297298
298- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L400 )
299+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L396 )
299300
300301Releases a hotkey (see [ ` send ` ] ( #keyboard.send ) ).
301302
@@ -304,7 +305,7 @@ Releases a hotkey (see [`send`](#keyboard.send)).
304305
305306## keyboard.** is\_ pressed** (hotkey)
306307
307- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L404 )
308+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L400 )
308309
309310
310311Returns True if the key is pressed.
@@ -322,7 +323,7 @@ is_pressed('ctrl+space') #-> True
322323
323324## keyboard.** call\_ later** (fn, args=(), delay=0.001)
324325
325- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L431 )
326+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L427 )
326327
327328
328329Calls the provided function in a new thread after waiting some time.
@@ -335,7 +336,7 @@ the current execution flow.
335336
336337## keyboard.** hook** (callback, suppress=False, on\_ remove=< ; lambda> ; )
337338
338- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L441 )
339+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L437 )
339340
340341
341342Installs a global listener on all available keyboards, invoking ` callback `
@@ -358,7 +359,7 @@ Returns the given callback for easier development.
358359
359360## keyboard.** on\_ press** (callback, suppress=False)
360361
361- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L472 )
362+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L468 )
362363
363364
364365Invokes ` callback ` for every KEY_DOWN event. For details see [ ` hook ` ] ( #keyboard.hook ) .
@@ -369,7 +370,7 @@ Invokes `callback` for every KEY_DOWN event. For details see [`hook`](#keyboard.
369370
370371## keyboard.** on\_ release** (callback, suppress=False)
371372
372- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L478 )
373+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L474 )
373374
374375
375376Invokes ` callback ` for every KEY_UP event. For details see [ ` hook ` ] ( #keyboard.hook ) .
@@ -380,7 +381,7 @@ Invokes `callback` for every KEY_UP event. For details see [`hook`](#keyboard.ho
380381
381382## keyboard.** hook\_ key** (key, callback, suppress=False)
382383
383- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L484 )
384+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L480 )
384385
385386
386387Hooks key up and key down events for a single key. Returns the event handler
@@ -396,7 +397,7 @@ affects it aswell.
396397
397398## keyboard.** on\_ press\_ key** (key, callback, suppress=False)
398399
399- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L508 )
400+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L504 )
400401
401402
402403Invokes ` callback ` for KEY_DOWN event related to the given key. For details see [ ` hook ` ] ( #keyboard.hook ) .
@@ -407,7 +408,7 @@ Invokes `callback` for KEY_DOWN event related to the given key. For details see
407408
408409## keyboard.** on\_ release\_ key** (key, callback, suppress=False)
409410
410- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L514 )
411+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L510 )
411412
412413
413414Invokes ` callback ` for KEY_UP event related to the given key. For details see [ ` hook ` ] ( #keyboard.hook ) .
@@ -418,7 +419,7 @@ Invokes `callback` for KEY_UP event related to the given key. For details see [`
418419
419420## keyboard.** unhook** (remove)
420421
421- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L520 )
422+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L516 )
422423
423424
424425Removes a previously added hook, either by callback or by the return value
@@ -430,7 +431,7 @@ of [`hook`](#keyboard.hook).
430431
431432## keyboard.** unhook\_ all** ()
432433
433- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L528 )
434+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L524 )
434435
435436
436437Removes all keyboard hooks in use, including hotkeys, abbreviations, word
@@ -442,7 +443,7 @@ listeners, [`record`](#keyboard.record)ers and [`wait`](#keyboard.wait)s.
442443
443444## keyboard.** block\_ key** (key)
444445
445- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L539 )
446+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L536 )
446447
447448
448449Suppresses all key events of the given key, regardless of modifiers.
@@ -453,7 +454,7 @@ Suppresses all key events of the given key, regardless of modifiers.
453454
454455## keyboard.** remap\_ key** (src, dst)
455456
456- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L546 )
457+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L543 )
457458
458459
459460Whenever the key ` src ` is pressed or released, regardless of modifiers,
@@ -465,7 +466,7 @@ press or release the hotkey `dst` instead.
465466
466467## keyboard.** parse\_ hotkey\_ combinations** (hotkey)
467468
468- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L560 )
469+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L557 )
469470
470471
471472Parses a user-provided hotkey. Differently from [ ` parse_hotkey ` ] ( #keyboard.parse_hotkey ) ,
@@ -478,7 +479,7 @@ each step is a list of all possible combinations of those scan codes.
478479
479480## keyboard.** add\_ hotkey** (hotkey, callback, args=(), suppress=False, timeout=1, trigger\_ on\_ release=False)
480481
481- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L600 )
482+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L597 )
482483
483484
484485Invokes a callback every time a hotkey is pressed. The hotkey must
@@ -525,7 +526,7 @@ add_hotkey('ctrl+alt+enter, space', some_callback)
525526
526527## keyboard.** remove\_ hotkey** (hotkey\_ or\_ callback)
527528
528- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L746 )
529+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L743 )
529530
530531
531532Removes a previously hooked hotkey. Must be called wtih the value returned
@@ -537,7 +538,7 @@ by [`add_hotkey`](#keyboard.add_hotkey).
537538
538539## keyboard.** unhook\_ all\_ hotkeys** ()
539540
540- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L754 )
541+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L751 )
541542
542543
543544Removes all keyboard hotkeys in use, including abbreviations, word listeners,
@@ -549,7 +550,7 @@ Removes all keyboard hotkeys in use, including abbreviations, word listeners,
549550
550551## keyboard.** remap\_ hotkey** (src, dst, suppress=True, trigger\_ on\_ release=False)
551552
552- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L765 )
553+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L762 )
553554
554555
555556Whenever the hotkey ` src ` is pressed, suppress it and send
@@ -568,7 +569,7 @@ remap('alt+w', 'ctrl+up')
568569
569570## keyboard.** stash\_ state** ()
570571
571- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L785 )
572+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L782 )
572573
573574
574575Builds a list of all currently pressed scan codes, releases them and returns
@@ -580,7 +581,7 @@ the list. Pairs well with [`restore_state`](#keyboard.restore_state) and [`resto
580581
581582## keyboard.** restore\_ state** (scan\_ codes)
582583
583- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L797 )
584+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L794 )
584585
585586
586587Given a list of scan_codes ensures these keys, and only these keys, are
@@ -592,7 +593,7 @@ pressed. Pairs well with [`stash_state`](#keyboard.stash_state), alternative to
592593
593594## keyboard.** restore\_ modifiers** (scan\_ codes)
594595
595- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L814 )
596+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L811 )
596597
597598
598599Like [ ` restore_state ` ] ( #keyboard.restore_state ) , but only restores modifier keys.
@@ -603,7 +604,7 @@ Like [`restore_state`](#keyboard.restore_state), but only restores modifier keys
603604
604605## keyboard.** write** (text, delay=0, restore\_ state\_ after=True, exact=None)
605606
606- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L820 )
607+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L817 )
607608
608609
609610Sends artificial keyboard events to the OS, simulating the typing of a given
@@ -628,7 +629,7 @@ value.
628629
629630## keyboard.** wait** (hotkey=None, suppress=False, trigger\_ on\_ release=False)
630631
631- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L875 )
632+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L872 )
632633
633634
634635Blocks the program execution until the given hotkey is pressed or,
@@ -640,7 +641,7 @@ if given no parameters, blocks forever.
640641
641642## keyboard.** get\_ hotkey\_ name** (names=None)
642643
643- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L889 )
644+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L886 )
644645
645646
646647Returns a string representation of hotkey from the given key names, or
@@ -667,7 +668,7 @@ get_hotkey_name(['+', 'left ctrl', 'shift'])
667668
668669## keyboard.** read\_ event** (suppress=False)
669670
670- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L920 )
671+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L917 )
671672
672673
673674Blocks until a keyboard event happens, then returns that event.
@@ -678,7 +679,7 @@ Blocks until a keyboard event happens, then returns that event.
678679
679680## keyboard.** read\_ key** (suppress=False)
680681
681- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L931 )
682+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L928 )
682683
683684
684685Blocks until a keyboard event happens, then returns that event's name or,
@@ -690,7 +691,7 @@ if missing, its scan code.
690691
691692## keyboard.** read\_ hotkey** (suppress=True)
692693
693- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L939 )
694+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L936 )
694695
695696
696697Similar to [ ` read_key() ` ] ( #keyboard.read_key ) , but blocks until the user presses and releases a
@@ -711,7 +712,7 @@ read_hotkey()
711712
712713## keyboard.** get\_ typed\_ strings** (events, allow\_ backspace=True)
713714
714- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L961 )
715+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L958 )
715716
716717
717718Given a sequence of events, tries to deduce what strings were typed.
@@ -738,7 +739,7 @@ get_type_strings(record()) #-> ['This is what', 'I recorded', '']
738739
739740## keyboard.** start\_ recording** (recorded\_ events\_ queue=None)
740741
741- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1006 )
742+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1005 )
742743
743744
744745Starts recording all keyboard events into a global variable, or the given
@@ -752,7 +753,7 @@ Use [`stop_recording()`](#keyboard.stop_recording) or [`unhook(hooked_function)`
752753
753754## keyboard.** stop\_ recording** ()
754755
755- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1018 )
756+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1017 )
756757
757758
758759Stops the global recording of events and returns a list of the events
@@ -764,7 +765,7 @@ captured.
764765
765766## keyboard.** record** (until=' ; escape' ; , suppress=False, trigger\_ on\_ release=False)
766767
767- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1030 )
768+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1029 )
768769
769770
770771Records all keyboard events from all keyboards until the user presses the
@@ -781,7 +782,7 @@ Note: for more details on the keyboard hook and events see [`hook`](#keyboard.ho
781782
782783## keyboard.** play** (events, speed\_ factor=1.0)
783784
784- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1044 )
785+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1043 )
785786
786787
787788Plays a sequence of recorded events, maintaining the relative time
@@ -797,7 +798,7 @@ the end of the function.
797798
798799## keyboard.** add\_ word\_ listener** (word, callback, triggers=[ ' ; space' ; ] , match\_ suffix=False, timeout=2)
799800
800- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1068 )
801+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1067 )
801802
802803
803804Invokes a callback every time a sequence of characters is typed (e.g. 'pet')
@@ -821,15 +822,15 @@ Returns the event handler created. To remove a word listener use
821822[ ` remove_word_listener(word) ` ] ( #keyboard.remove_word_listener ) or [ ` remove_word_listener(handler) ` ] ( #keyboard.remove_word_listener ) .
822823
823824Note: all actions are performed on key down. Key up events are ignored.
824- Note: word matches are ** case sensitive** .
825+ Note: word mathes are ** case sensitive** .
825826
826827
827828
828829<a name =" keyboard.remove_word_listener " />
829830
830831## keyboard.** remove\_ word\_ listener** (word\_ or\_ handler)
831832
832- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1124 )
833+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1123 )
833834
834835
835836Removes a previously registered word listener. Accepts either the word used
@@ -842,7 +843,7 @@ during registration (exact string) or the event handler returned by the
842843
843844## keyboard.** add\_ abbreviation** (source\_ text, replacement\_ text, match\_ suffix=False, timeout=2)
844845
845- [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1132 )
846+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/__init__.py#L1131 )
846847
847848
848849Registers a hotkey that replaces one typed text with another. For example
@@ -865,3 +866,15 @@ For more details see [`add_word_listener`](#keyboard.add_word_listener).
865866
866867
867868
869+ <a name =" keyboard.normalize_name " />
870+
871+ ## keyboard.** normalize\_ name** (name)
872+
873+ [ \[ source\] ] ( https://github.com/boppreh/keyboard/blob/master/keyboard/_canonical_names.py#L1233 )
874+
875+
876+ Given a key name (e.g. "LEFT CONTROL"), clean up the string and convert to
877+ the canonical representation (e.g. "left ctrl") if one is known.
878+
879+
880+
0 commit comments