[xmonad] Issue 177 in xmonad: xmonad does not follow ICCCM and ignores WM_TAKE_FOCUS protocol

codesite-noreply at google.com codesite-noreply at google.com
Wed Sep 14 04:58:06 CEST 2011

Comment #80 on issue 177 by gere... at gmail.com: xmonad does not follow ICCCM  
and ignores WM_TAKE_FOCUS protocol

I took a look at if this could be done through extensible state and a  
modification of the logHook in Hooks.ICCCMFocus and my opinion is that it  

There are a few problems with the logHook as is:

  - It uses currentTime as the event time, violating the ICCCM
  - It sends a WM_TAKE_FOCUS client message every time the logHook is run

Problems with the out-of-core approach in general are:

  - No way to connect a focus change to the event that caused it. The  
closest possibility is to have an eventHook that stores the event in some  
extensible state or in an IORef cell. The problem is there is no way to  
clear it once event processing has finished.
  - The logHook is the only reasonable place to put the sending of the  
WM_TAKE_FOCUS client message, but the logHook is called many more times  
than the focus is changed. It might be sufficient to remember the focused  
window from the last invocation and send when it's different, but it's  
still quite hackish.

The in-core solution as-is is found wanting as well:

  - When a window refuses to take focus (like many on-screen keyboards) it's  
not possible to manage the window. XMonad's management focus is tied  
directly to input focus.

I agree with #79 that xmonad should take care to implement the ICCCM  
properly without needing any contrib modules.

More information about the xmonad mailing list