Skip to content
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

Add level3_shift special key #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Glandos
Copy link
Contributor

@Glandos Glandos commented May 14, 2018

In a lot of keyboard layouts (See the output of grep -r ralt_switch /usr/share/X11/xkb/), the AltGr is mapped to the ISO_Level3_Shift.
I decided to strip the ISO_ prefix from the member name. Feel free to integrate it if you like.

In a lot of keyboard (See the output of `grep -r ralt_switch  /usr/share/X11/xkb/`), the AltGr is mapped to the ISO_Level3_Shift.
I decided to strip the `ISO_` prefix from the member name. Feel free to integrate it if you like.
@moses-palmer
Copy link
Owner

Thank you for your pull request.

Does this solve a bug with pynput? pynput.Keyboard.Key.alt_gr is intended to be usable as ISO_Level3_Shift.

@Glandos
Copy link
Contributor Author

Glandos commented May 14, 2018

With your test program, I have the following output when pressing and releasing my AltGr key, with a French (Bepo) layout:

alphanumeric key None pressed
<65027> released

But since your last comment, I tested the following code:

from pynput.keyboard import Key, Controller
keyboard = Controller()
with keyboard.pressed(Key.alt_gr):
    keyboard.press('a')
    keyboard.release('a')

with keyboard.pressed(Key.level3_shift):
    keyboard.press('a')
    keyboard.release('a')

And I have the following output:

æa

This is not the correct output. The correct output should be ææ with my current layout. So I don't know how to make the key recognized and working with fake inputs. Any idea?

Comment on lines 90 to +91
alt_gr = KeyCode._from_symbol('Mode_switch')
level3_shift = KeyCode._from_symbol('ISO_Level3_Shift')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alt_gr = KeyCode._from_symbol('Mode_switch')
level3_shift = KeyCode._from_symbol('ISO_Level3_Shift')
alt_gr = KeyCode._from_symbol(''ISO_Level3_Shift')
mode_switch = KeyCode._from_symbol('Mode_switch')

Most xkb layouts in /usr/share/X11/xkb/symbols by far assign the 'ISO_Level3_Shift to the right AltGr key. Only digital_vndr/pc nec_vndr/jp pk sun_vndr/tw and sun_vndr/jp use Mode_switch. With that mind, it makes more sense to swap the two.

PS: The alphabetical order is broken with my suggestion so don't hit the "Apply" button. Move mode_switch between left and page_down to preserve the alphabetical order.

Copy link

@thomaslc66 thomaslc66 Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 90 + double quote ''ISO_Level3_Shift'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants