moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.78k stars 247 forks source link

Wrong keys sent with altgr-intl keyboard layout (Linux) #573

Open dominique-unruh opened 1 year ago

dominique-unruh commented 1 year ago

Description

When using keyboard layout altgr-intl on Linux (X), and sending letters accessible via AltGr, the wrong characters are sent.

For example, when sending ü (which would be typed AltGr-Y), it sends Y (which would be typed Shift-Y).

Platform and pynput version Pynput: 1.7.6 Python: 3.11.5 OS: Linux, Endeavour OS (Linux unruh-work 6.5.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 13 Sep 2023 08:37:40 +0000 x86_64 GNU/Linux)

To Reproduce

Configure keyboard (in the shell):

setxkbmap -option caps:hyper2 -layout us -variant altgr-intl

And in Python:

import pynput; import time; k = pynput.keyboard.Controller(); k.tap('ü')