You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to get mods keysym names from keysym numbers #272
I needed to return for Shift dynamically Shift_L so I wrote this code and my question is whether part of the code marked as here could become part of this lib:
import Xlib.XK
mods_to_indexes_x11 = {
"Shift": Xlib.X.ShiftMapIndex,
"Lock": Xlib.X.LockMapIndex,
"Control": Xlib.X.ControlMapIndex,
"Mod1": Xlib.X.Mod1MapIndex,
"Mod2": Xlib.X.Mod2MapIndex,
"Mod3": Xlib.X.Mod3MapIndex,
"Mod4": Xlib.X.Mod4MapIndex,
"Mod5": Xlib.X.Mod5MapIndex
}
if display and mod_name in mods_to_indexes_x11:
mods = display.get_modifier_mapping()
first_keycode = mods[mods_to_indexes_x11[mod_name]][0]
if first_keycode:
key = EV_KEY.codes[int(first_keycode) - 8]
keysym = display.keycode_to_keysym(first_keycode, 0)
# here
for key in Xlib.XK.__dict__:
if key.startswith("XK") and Xlib.XK.__dict__[key] == keysym:
return key[3:]
# here
Activity