[xmonad] Re: KeyEvent stream manipulation

Daniel dan.in.a.bottle at gmail.com
Thu Sep 23 16:57:00 EDT 2010

I put up a more extensive description of this problem on stackoverflow
at http://stackoverflow.com/questions/3781831/drop-rewrite-generate-keyboard-events-under-linux

You can reply there or here (preferably here if it is XMonad specific,
as I haven't phrased the question in terms of XMonad on SO).

Thanks for any pointers.

On Thu, Sep 23, 2010 at 10:27 PM, Daniel <dan.in.a.bottle at gmail.com> wrote:
> For what I want to do I need to have exclusive access to the keyboard
> events so that I can rewrite them. I have been experimenting a bit
> with this in XMonad, but passive grabs don't work.
> The problem with passive grabs is with overlapping events. This is what happens:
> * press key A
> * grab converts from passive to active
> * KeyEvent keyPress A is delivered to XMonad
> * B is pressed
> * KeyEvent keyPress B gets delivered to XMonad (B is registered as
> passive grab as well, but gets delivered, because technically, we're
> in an active grab now)
> * A is released
> * KeyEvent keyRelease A gets delivered to XMonad
> * active grab on A reverts to passive (incl some FocusEvents &
> KeymapNotify to inform us that B is still held)
> * B is released
> * KeyEvent keyRelease B gets NOT delivered to XMonad, it's a regular
> KeyEvent, no grab is active, and the passive grab on B is not
> triggered, because its keyPress event occurred during another
> (shadowing) activeGrab. (Actually, if you keep pressing B, after about
> a second or so, X realizes that there should be a grab active and
> enters the grab. Unfortunately, this is not fast enough when typing.
> Just to be clear, this is a problem of passive grabs, not with XMonad.
> Because of this behaviour it seems that the only thing that gets me
> there within X is a permanent active grab (keyboardGrab). Other
> extensions use active grabs, but they only do this for a limited time,
> usually after being triggered (eg. CycleRecentWS, Submap, GridHS,
> CycleWindows).
> So my questions:
> * Is such a permanent active grab a good idea within X? I'm worrying
> about problems interacting with other programs who might attempt grabs
> or XMonad losing the grab and not knowing about it.
> * If this is not a good idea, what should I look into to get this
> capability (exclusive access to transform the keyboard event stream,
> before it reaches any application).
> * Where/who should I ask to get an informed answer if not here?
> My end target are X applications, and I expect that there will be a
> tight integration with the window manager (likely XMonad). But I'm
> willing to look at a variety of points to hook into the event stream.
> Thanks

More information about the xmonad mailing list