[xmonad] Respecting the Window Manager Input Hint

Wirt Wolff wirtwolff at gmail.com
Wed Feb 3 12:10:12 EST 2010

Excerpts from Bas van Dijk's message of Wed Feb 03 03:57:31 -0700 2010:
> ..  <snip>
> For correct operation, it's crucial that onboard does not get focus
> itself because then the key events will be send to itself! To prevent
> getting focus, onboard gives a hint to the window manager to not
> accept focus.
> $ xprop     # (click on the onboard window)
> ...
>         Client accepts input or input focus: False
> ...
> Unfortunately xmonad does not respect this hint by focusing the
> onboard window anyway when my pointer enters it.
> How can I prevent this?
> Possible solutions:
> * Use a manage hook that removes onboard from xmonad management so
> that it won't get focus anymore:
> className =? "Onboard" --> doIgnore
> While this solves my problem this has the disadvantage that the
> onboard window is not managed anymore.
> * Use XMonad.Layout.BoringWindows and the code in the recent thread on
> "focus handling". Unfortunately I didn't get this to work. (Maybe I
> have to put some more time into this)

In my experience these are painful if any windows are floating,
as it's difficult to track which windows cover which as z-order
gets shuffled. (Not familiar with recent thread, though, just
"standard" boring BoringWindows.)

> * Patch xmonad to respect the Window Manager Input Hint by not giving
> focus to windows that don't want't to get focus.
> How difficult would this be?

Warning, these are quick responses, not thought through very deeply;
hopfully they are helpful. ;-)

Might be worth trying out the patches posted on issue 177 on the
tracker [177]; there are ones applicable to recent darcs or to
a darcs get of tag 0.9 xmonad core. While issue 177 doesn't
mention onboard app specifically, nor the WM_HINTS focus alerting
method you describe, those patches enabled proper operation of
similar apps, like scim input and Cellwriter input panel.
Hopefully they work for you even without modification, but worth
a look. 

For an example of reading state from wm hints in handleEventHook,
see fullscreenEventHook in contrib, in darcs version of
XMonad.Hooks.EwmhDesktops. This might be helpful coupled with
boring approach if you did decide to go that route.

[177] http://code.google.com/p/xmonad/issues/detail?id=177

More information about the xmonad mailing list