-
Notifications
You must be signed in to change notification settings - Fork 283
Added many new X.org keysyms #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,14 +112,25 @@ def _from_media(cls, name, **kwargs): | |
| """ | ||
| return cls._from_symbol('XF86_Audio' + name, **kwargs) | ||
|
|
||
| @classmethod | ||
| def _from_iso(cls, name, **kwargs): | ||
| """Creates a ISO key from a partial name. | ||
|
|
||
| :param str name: The name. The actual symbol name will be this string | ||
| with ``'ISO_'`` prepended. | ||
|
|
||
| :return: a key code | ||
| """ | ||
| return cls._from_symbol('ISO_' + name, **kwargs) | ||
|
|
||
|
|
||
| # pylint: disable=W0212 | ||
| class Key(enum.Enum): | ||
| # Default keys | ||
| alt = KeyCode._from_symbol('Alt_L') | ||
| alt_l = KeyCode._from_symbol('Alt_L') | ||
| alt_r = KeyCode._from_symbol('Alt_R') | ||
| alt_gr = KeyCode._from_symbol('Mode_switch') | ||
| alt_gr = KeyCode._from_iso('Level3_Shift') | ||
| backspace = KeyCode._from_symbol('BackSpace') | ||
| caps_lock = KeyCode._from_symbol('Caps_Lock') | ||
| cmd = KeyCode._from_symbol('Super_L') | ||
|
|
@@ -154,7 +165,13 @@ class Key(enum.Enum): | |
| f19 = KeyCode._from_symbol('F19') | ||
| f20 = KeyCode._from_symbol('F20') | ||
| home = KeyCode._from_symbol('Home') | ||
| xorg_hyper = KeyCode._from_symbol('Hyper_L') | ||
| xorg_hyper_l = KeyCode._from_symbol('Hyper_L') | ||
| xorg_hyper_r = KeyCode._from_symbol('Hyper_R') | ||
| left = KeyCode._from_symbol('Left') | ||
| xorg_meta = KeyCode._from_symbol('Meta_L') | ||
| xorg_meta_l = KeyCode._from_symbol('Meta_L') | ||
| xorg_meta_r = KeyCode._from_symbol('Meta_R') | ||
| page_down = KeyCode._from_symbol('Page_Down') | ||
| page_up = KeyCode._from_symbol('Page_Up') | ||
| right = KeyCode._from_symbol('Right') | ||
|
|
@@ -165,15 +182,59 @@ class Key(enum.Enum): | |
| tab = KeyCode._from_symbol('Tab') | ||
| up = KeyCode._from_symbol('Up') | ||
|
|
||
| iso_lock = KeyCode._from_iso('Lock') | ||
| iso_level2_latch = KeyCode._from_iso('Level2_Latch') | ||
| iso_level3_shift = KeyCode._from_iso('Level3_Shift') | ||
| iso_level3_latch = KeyCode._from_iso('Level3_Latch') | ||
| iso_level3_lock = KeyCode._from_iso('Level3_Lock') | ||
| iso_group_shift = KeyCode._from_iso('Group_Shift') | ||
| iso_group_latch = KeyCode._from_iso('Group_Latch') | ||
| iso_group_lock = KeyCode._from_iso('Group_Lock') | ||
| iso_next_group = KeyCode._from_iso('Next_Group') | ||
| iso_next_group_lock = KeyCode._from_iso('Next_Group_Lock') | ||
| iso_prev_group = KeyCode._from_iso('Prev_Group') | ||
| iso_prev_group_lock = KeyCode._from_iso('Prev_Group_Lock') | ||
| iso_first_group = KeyCode._from_iso('First_Group') | ||
| iso_first_group_lock = KeyCode._from_iso('First_Group_Lock') | ||
| iso_last_group = KeyCode._from_iso('Last_Group') | ||
| iso_last_group_lock = KeyCode._from_iso('Last_Group_Lock') | ||
| iso_left_tab = KeyCode._from_iso('Left_Tab') | ||
| iso_move_line_up = KeyCode._from_iso('Move_Line_Up') | ||
| iso_move_line_down = KeyCode._from_iso('Move_Line_Down') | ||
| iso_partial_line_up = KeyCode._from_iso('Partial_Line_Up') | ||
| iso_partial_line_down = KeyCode._from_iso('Partial_Line_Down') | ||
| iso_partial_space_left = KeyCode._from_iso('Partial_Space_Left') | ||
| iso_partial_space_right = KeyCode._from_iso('Partial_Space_Right') | ||
| iso_set_margin_left = KeyCode._from_iso('Set_Margin_Left') | ||
| iso_set_margin_right = KeyCode._from_iso('Set_Margin_Right') | ||
| iso_release_margin_left = KeyCode._from_iso('Release_Margin_Left') | ||
| iso_release_margin_right = KeyCode._from_iso('Release_Margin_Right') | ||
| iso_release_both_margins = KeyCode._from_iso('Release_Both_Margins') | ||
| iso_fast_cursor_left = KeyCode._from_iso('Fast_Cursor_Left') | ||
| iso_fast_cursor_right = KeyCode._from_iso('Fast_Cursor_Right') | ||
| iso_fast_cursor_up = KeyCode._from_iso('Fast_Cursor_Up') | ||
| iso_fast_cursor_down = KeyCode._from_iso('Fast_Cursor_Down') | ||
| iso_continuous_underline = KeyCode._from_iso('Continuous_Underline') | ||
| iso_discontinuous_underline = KeyCode._from_iso('Discontinuous_Underline') | ||
| iso_emphasize = KeyCode._from_iso('Emphasize') | ||
| iso_center_object = KeyCode._from_iso('Center_Object') | ||
|
|
||
| brightness_up = KeyCode._from_symbol('XF86_MonBrightnessUp') | ||
| brightness_down = KeyCode._from_symbol('XF86_MonBrightnessDown') | ||
|
|
||
| media_play_pause = KeyCode._from_media('Play') | ||
| media_stop = KeyCode._from_media('Stop') | ||
| media_volume_mute = KeyCode._from_media('Mute') | ||
| media_volume_down = KeyCode._from_media('LowerVolume') | ||
| media_volume_up = KeyCode._from_media('RaiseVolume') | ||
| media_previous = KeyCode._from_media('Prev') | ||
| media_next = KeyCode._from_media('Next') | ||
| mic_mute = KeyCode._from_media('MicMute') | ||
|
|
||
| insert = KeyCode._from_symbol('Insert') | ||
| menu = KeyCode._from_symbol('Menu') | ||
| compose = KeyCode._from_symbol('Multi_key') | ||
| multi_key = KeyCode._from_symbol('Multi_key') | ||
| num_lock = KeyCode._from_symbol('Num_Lock') | ||
| pause = KeyCode._from_symbol('Pause') | ||
| print_screen = KeyCode._from_symbol('Print') | ||
|
|
@@ -513,7 +574,8 @@ class Listener(ListenerMixin, _base.Listener): | |
| KEYPAD_KEYS['KP_8']: KeyCode.from_char('8'), | ||
| KEYPAD_KEYS['KP_9']: KeyCode.from_char('9'), | ||
| KEYPAD_KEYS['KP_Add']: KeyCode.from_char('+'), | ||
| KEYPAD_KEYS['KP_Decimal']: KeyCode.from_char(','), | ||
| KEYPAD_KEYS['KP_Begin']: KeyCode.from_char('Begin'), | ||
| KEYPAD_KEYS['KP_Decimal']: KeyCode.from_char('.'), | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change highlights an issue with this definition: this depends on the decimal marker used for the input language; on my system, the current definition is correct and this change breaks the library, but I suppose that the current definitions breaks the library for most other systems. |
||
| KEYPAD_KEYS['KP_Delete']: Key.delete, | ||
| KEYPAD_KEYS['KP_Divide']: KeyCode.from_char('/'), | ||
| KEYPAD_KEYS['KP_Down']: Key.down, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate that you have added these media and brightness codes, but I will not be able to merge this until matching codes have been added to the remaining backends. I do not mind looking them up though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "remaining backends", do you mean recognizing
brightness_upkeys on other operating systems as well, like Windows?