From 6f9961f2589cf37749239acf938a7e40ae9e9a21 Mon Sep 17 00:00:00 2001 From: BoppreH Date: Sun, 25 Feb 2018 18:34:08 +0100 Subject: [PATCH] Be more lenient when adding uppercase key names --- keyboard/_winkeyboard.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keyboard/_winkeyboard.py b/keyboard/_winkeyboard.py index 4a3251d7..1bf819aa 100644 --- a/keyboard/_winkeyboard.py +++ b/keyboard/_winkeyboard.py @@ -402,10 +402,12 @@ def _setup_name_tables(): # Get key names from ToUnicode, GetKeyNameText, MapVirtualKeyW and official virtual keys. names = list(get_event_names(*entry)) if names: - to_name[entry] = names + # Also map lowercased key names, but only after the properly cased ones. + lowercase_names = [name.lower() for name in names] + to_name[entry] = names + lowercase_names # Remember the "id" of the name, as the first techniques # have better results and therefore priority. - for i, name in enumerate(map(normalize_name, names)): + for i, name in enumerate(map(normalize_name, names + lowercase_names)): from_name[name].append((i, entry)) # TODO: single quotes on US INTL is returning the dead key (?), and therefore