pynput icon indicating copy to clipboard operation
pynput copied to clipboard

Add level3_shift special key

Open Glandos opened this issue 6 years ago • 2 comments

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.

Glandos avatar May 14 '18 12:05 Glandos

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.

moses-palmer avatar May 14 '18 12:05 moses-palmer

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?

Glandos avatar May 14 '18 12:05 Glandos