gvalkov / python-evdev

Python bindings for the Linux input subsystem
https://python-evdev.rtfd.org/
BSD 3-Clause "New" or "Revised" License
336 stars 112 forks source link

creating a uinput device changes keymap #168

Closed pfps closed 2 years ago

pfps commented 2 years ago

When I create a uinput device the keymap for my laptop keyboard changes. I see this when running the following simple program

#!/usr/bin/env python3
import evdev
import time
fake = evdev.uinput.UInput()
time.sleep(5)
fake.close()

Here is what happens when I run the program:

idefix testing> setxkbmap -layout "us,us,us,us" -variant ",dvorak,colemak," -option grp:shifts_toggle
idefix testing> setxkbmap -query
rules:      evdev
model:      pc104
layout:     us,us,us,us
variant:    ,dvorak,colemak,
options:    grp:shifts_toggle
idefix testing> ./uinput.py 
idefix testing> setxkbmap -query
rules:      evdev
model:      pc104
layout:     us,us,us,us
variant:    ,intl,alt-intl,dvorak

Is the change to the keyboard mapping a desired change? How can I not have this happen?

sezanzeb commented 2 years ago

Is the change to the keyboard mapping a desired change?

This is controlled by your desktop environment or x11/xkb, depending on your installation. python-evdev can't do anything about this

How can I not have this happen?

Unfortunately I don't know. Try wayland if you are on x11 or a different desktop environment.

pfps commented 2 years ago

Thanks.