SavinaRoja/PyUserInput

Wrong keys inputted when the layout is changed through GNOME

steelcowboy opened this issue · 4 comments

I noticed that GNOME's keyboard switcher does not use setxkb, so as far as X is concerned if I change to Colemak my keyboard is still in QWERTY so it presses the corresponding key locations. Therefore, GNOME should be treated as a special case for when the X server is found.

I can't figure out just how GNOME sets the keyboard layout. I'd like to fix the issue myself but need to figure out how to interface with GNOME stuff in Python (maybe dbus?). Any suggestions?

Special-casing Gnome sounds like a bad idea. Before you know it we need code for every DE out there. We need a general solution for this.

I mean, if you change Gnome settings and open a non-Gnome app like xterm, does it also use the incorrect keyboard layout? If so, I'd consider that a Gnome bug. If not, we need to figure out a better way to detect key codes.

I think GNOME only needs a special case because it manages the keyboard
independently from X. I'm not sure what KDE, XFCE, Budgie, etc do but if
they don't directly change X the only way to write a cross-desktop solution
would be to create a new keycode-detecting library.

GNOME changes the keyboard layout for the entire session, the app is not
important. I had it type in URXVT and Chrome. It's not a GNOME bug I don't
think -- GNOME just doesn't inform X if the variant changes because it
handles that change itself. I can confirm changing the variant with
setxkbmap works fine in GNOME, I just am learning Colemak and need to
switch variants often when I need to type faster.

I vaguely remember this being an issue with fake_input, since it uses a
lot of implicit state.

In pynput, I had to use send_event of the Window object to work around
this; this is unfortunately a lot of work. Perhaps you could test with that
library and see if it works? If it does, copying code from pynput might
be worth the effort.

On 19 Jul 2016 4:35 p.m., "Jim Heald" notifications@github.com wrote:

I think GNOME only needs a special case because it manages the keyboard
independently from X. I'm not sure what KDE, XFCE, Budgie, etc do but if
they don't directly change X the only way to write a cross-desktop solution
would be to create a new keycode-detecting library.

GNOME changes the keyboard layout for the entire session, the app is not
important. I had it type in URXVT and Chrome. It's not a GNOME bug I don't
think -- GNOME just doesn't inform X if the variant changes because it
handles that change itself. I can confirm changing the variant with
setxkbmap works fine in GNOME, I just am learning Colemak and need to
switch variants often when I need to type faster.

On Jul 19, 2016 02:11, "Pepijn de Vos" notifications@github.com wrote:

Special-casing Gnome sounds like a bad idea. Before you know it we need
code for every DE out there. We need a general solution for this.

I mean, if you change Gnome settings and open a non-Gnome app like xterm,
does it also use the incorrect keyboard layout? If so, I'd consider that a
Gnome bug. If not, we need to figure out a better way to detect key codes.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<
#92 (comment)

,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AIxn7AQXLIiXcyNWvmaZn-thEMr21Qi0ks5qXJS-gaJpZM4JPMvz

.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#92 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjOY7QDhFn5w7BNXNshZdkRmLDjZVQwks5qXOCzgaJpZM4JPMvz
.

I just tried https://rosettacode.org/wiki/Simulate_input/Keyboard#C and it had the same issue, but to me it looks like that uses send_event. I think the problem is that it goes through X when GNOME may need to process it somehow