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

Re: Configuring hotplugged input devices



On Mon 25 Nov 2019 at 09:32:43 (-0500), Henning Follmann wrote:
> On Mon, Nov 25, 2019 at 03:01:03PM +0100, Nicolas George wrote:
> > What is the standard for a user to automatically configure hotplugged
> > input devices under X11, to set the keyboard layout, repeat speed,
> > pointer acceleration, etc.?
> > 
> > I know how to do it manually using xinput and xkbcomp.
> > 
> > I would like a generic solution, whatever desktop environment may
> > propose its own solution, I do not use it.
> > 
> > I want a solution for simple users, without root permissions to edit
> > xorg.conf.
> > 
> > If there is no standard solution, would you like one? I have a small
> > program that can serve as the basis for one, I can publish it if that
> > would be useful.
> > 
> > Extra question:
> > 
> > Is there a standard way to bind a key on a specific keyboard? Basically
> > an XInput-aware version of xbindkeys?
> 
> That's what udev is for
> create a file like
> /etc/udev/rules.d/99-usb-keyboard.rules
> 
> with contents like:
> ACTION=="add", ATTRS{name}=="USB Keyboard", RUN="<path to your script>"
> 
> The ATTRS{} part is a selector. If you know the idVendor and idProduct
> you can be very selective.
> example:
> ACTION=="add", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", RUN="your_script for this keyboard"
> 
> After that you have to reload the udev stack
> 
> udevadm control --reload-rules;
> 
> A reboot would work too.

My problem is knowing what to put in the script to make a keyboard
layout apply only to a specific keyboard. I connect two keyboards;
one is an old IBM M with British layout (PS/2), the other is a
Logitech K520 with US layout (wireless).

Currently the machine boots in GB mode with the PS/2, and I have
kbdgb and kbdus functions to switch back and forth when I use
either keyboard. (For just the odd character I use memory of the
easier transpositions (like @"), or the composition key.)

How do you make layout scripts so specific?

Cheers,
David.


Reply to: