Changing key repeat behaviour for individual xinput devices

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 21 05:57:38 UTC 2019


On Mon, Mar 18, 2019 at 01:21:56PM +0300, Ilya Anfimov wrote:
> On Fri, Mar 15, 2019 at 08:54:13AM +1000, Peter Hutterer wrote:
> > On Wed, Mar 13, 2019 at 05:19:21PM +0100, Timo Paulssen wrote:
> > > Hello xorgers,
> > > 
> > > I recently got a small bluetooth keyboard. I'd like to try to use it as
> > > a secondary keyboard for things like shortcuts, but my first experiment
> > > was to turn it into a midi keyboard with a combination of PortMIDI and
> > > xinput float + xinput test. Unfortunately, it has a pretty aggressive
> > > key repetition rate set up.
> > > 
> > > The right way to fix this would normally be xset, but IIUC that'd change
> > > the behavior of all connected keyboards. xinput has a flag
> > > --get-feedbacks that gets me an XkbdFeedbackClass with
> > > "global_auto_repeat" and percent/pitch/duration properties. I'd assume
> > > that's the right thing to change, but it looks like the only classes
> > > xinput's commandline utility lets me change are ptr-feedback and
> > > integer-feedback, which seems to be about acceleration and scaling or
> > > something like that?
> > > 
> > > Will I have to write a little snippet of C to change these particular
> > 
> > there is/was an "xkbset" utility, not sure if that supports per-device flags
> > though. there's also the option of setting a custom keymap for that device
> 
>  It doesn't.
>  I had checked xset, xkbset, xinput, xkbcomp -- all of them either
> don't have global rate controls or are using core device.
> 
> 
> > (setxkbmap and xkbcomp have deviceid options) but paging in *how* to disable
> > autorepeat through an xkb map is beyond my mental capabilities right now.
> 
>  Well, it should be possible to enable toggle of repeat by adding
> including AccessX(full) compat (sometimes already enabled,  often
> enabled  AccessX(basic) ) and assigning RepeatKeys_Enable to some
> key.
> 
>  But this looks ridiculous -- to press some key when a user  just
> wants to disable repeat.

yeah, but that's what we have tools for. setxkbmap -layout looks simple, but
what it does under the hood is a lot more involved.

>  And  no, xkbcomp doesn't have direct enabling of repeat or other
> XKBSetControl, there is no such words in xkb files. Also  libxkb-
> file,  which  xkbcomp  uses  for changing server parameters -- it
> have fields in it's structures for that controls --  but  it  ex-
> plicitly skips setting XKBSetControls:
> srvmisc.c:
> 
> #ifdef NOTYET
>     if (!XkbSetControls(dpy,XkbAllControlsMask,xkb))
>         return False;
> #endif
> 
>  It  seems like would be good to add -dev option to xset and xkb-
> set (for xset -- also for mouse controls) and rate or  maybe  all
> XKBSetControls controls to xinput.

xset uses core protocol requests only so a -dev option wouldn't make sense
here. xkbset could take device ids but I'm not sure it still has an upstream.
xinput - sure, I'll take pull requests.

Cheers,
   Peter
 


More information about the xorg mailing list