per-keyboard user-defined X keymap and keyboard behaviour

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 7 21:02:04 PST 2010


On Fri, Jan 08, 2010 at 05:46:06PM +1300, martin f krafft wrote:
> Thanks for taking the time to respond!
> 
> also sprach Peter Hutterer <peter.hutterer at who-t.net> [2010.01.08.1608 +1300]:
> > xkbcomp supports -I, but the xserver doesn't provide an option to
> > set a custom include path. so your best bet is to run xkbcomp at
> > runtime for xkb files outside the default paths.
> 
> This is what I do right now, but the question of "runtime" is what
> bothers me: what is "runtime" when you plug a USB keyboard into an
> existing X session?

with the above I meant there's no startup option of configuration option you
can use to change the X Server's defaults.
so you need to run it after the keyboard was recognized by the server
(i.e. shortly after plugging it in)

> > > 3. If (1) or (2) are not possible, then what else could I do? Is
> > > there a way to subscribe to Xorg in such a way that it informs
> > > me (or calls back) upon configuration of a new input device,
> > > such that I can relaod the keymap with xkbcomp and reset the
> > > delay/rate with xset?
> > 
> > DevicePresence are sent for each device added, removed, enabled
> > and disabled. For servers 1.7 and later, an
> > XIDeviceHierarchChanged event is sent as well.
> 
> Okay, but to listen/react to those, I need to write a daemon using
> select(), right?

you need to write a daemon that registers for these events and reacts on
receiving them. select() is the least of your issues there (and strictly not
necessary, XNextEvent() will do)

> > > 4. After I plugged in the external keyboard, I have two
> > > keyboards. While the internal one uses my custom keymap and
> > > rate/delay settings, the external one has defaults. This makes
> > > me think that Xorg keeps these settings per-device. However,
> > > neither xset nor xkbcomp seem to allow me to specify a "target
> > > device", so that I do not seem to be able to configure just one
> > > device, but always have to configure all of them. Am
> > > I overlooking something?
> > 
> > xkbcomp -i <device id>, as I said xset doesn't let you do that.
> 
> I couldn't figure out what <device id> is supposed to be.

xinput --list --short list all devices currently detected by the server.
device id is a unique numeric id assigned to all input devices in a 7 bit
range (with XI2 16 bit but here be dragons, the server will probably blow up
if you try it). note that device ids are reused when devices are removed.

Cheers,
  Peter



More information about the xorg mailing list