[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: X11 and hot-plugged keyboards and multiple layouts



Nicolas George <george@nsup.org> writes:

> Nicolas George (12020-02-19):
>> ----8<----8<----8<----8<---- xi2watch.c ---->8---->8---->8---->8----
>
> Hi.
>
> I am replying to my own mail of three years ago where I explained how to
> configure X11 to set different layouts on different keyboards and handle
> hot-plugging without root privileges. Since a standard tool did not
> exist yet, I had attached a small program of mine to do it.
>
> I have seen this code reproduced on the web, so at least somebody is
> using it. Good.
>
> Then it might interest you that I have made an extended version of it
> and published it:
>
> https://gitlab.com/Cigaes/xi2bind

I finally gave xi2bind a try, using the hierarchy option to do something
(run xmodmap) when a keyboard is plugged in. Or in my case, I have a USB
switch which connects or disconnects a USB hub with my mouse and
keyboard connected to the hub.

It works fine but usage was a little baffling and it doesn't help the
example on how to use the hierarchy command doesn't work due to wrong
quoting.

With some work I think I've worked out which event when the keyboard is
plugged in I should use to run xmodmap, out of the six that happen when
my keyboard is plugged in. With the mouse and hub the total number of
events is actually 16!

For sure it doesn't really matter if xmodmap runs sixteen or six times
or only once but it feels right.

So for adding my extra keys to my quite normal US layout keyboard this
works fine. Unfortunately something weird happens with the modifier keys
and my extra keys working depend on setting Alt_R to mode_switch and
that's not something I can automate currently. Nothing to do with
xi2bind though.


Reply to: