[xmonad] Delays in focus update...

Norbert Zeh nzeh at cs.dal.ca
Mon Feb 6 23:31:30 CET 2012

Allen S. Rout [2012.02.06 1453 -0500]:
> I'm running xmonad now on a 4-monitor setup which is slowly
> approaching perfect-for-me.  Yay, and thanks!
> But I've noticed a certain lack of responsiveness when I make
> sweeping motions with the mouse, and I've now done a bit of an
> experiment  that seems to narrow it down.
> To observe this behavior:
> + open up a lot of shells.  Mod-shift-enter 15 or 20 times on an
> empty workspace will do.
> + Pick a side of the screen which is an edge, not adjacent to another screen
> + Move your mouse to that screen, on the -opposite- side from the edge.
> + Swiftly move your mouse to the edge,  like _fast_.  10th of a
> second or so.  You're crossing many terminals.
> + Watch the successive terminals momentarily get focus;  count the
> time (seconds if you go nuts on the count) it takes for focus to get
> where your mouse is.
> .... So it seems it takes constant, substantial subsecond time
> between window X gets focus, and when xmonad is willing to consider
> that it might have lost it.
> Is there some timing loop in there?  Or is there something
> fundamental and X-y happening that limits this?    In other WMs, I'm
> accustomed to focus shifting nearly instantaneously, but I might be
> missing something.

I just tested this on my 4-monitor setup.  I don't think it's the number of
monitors that makes a difference.  It's the number of windows you open.  I am
using UpdatePointer, and there the delay in focus update may in fact lead to an
infinite loop of focus switching between two windows where triggered the loop by
moving the pointer back and forth quickly between the two windows ininitially.

I did a very superficial test of the source of the problem, and in my case it
seems to be the decoration module that adds tabs above all my windows.  Without
decoration, I can open 30+ terminals and focus switch feels almost snappy and
certainly does not trigger the endless loop.  The moment I turn any form of
decoration on, focus switching, at least with many windows, starts to feel
sluggish.  Are you using window decorations?

I am not entirely certain what inside the decoration module would create such
massive delays - the CPU usage on one of my cores goes up to 50% when I'm in the
endless loop.  I'm not too keen to dig into it because this module is a monster,
but it may simply be necessary.


More information about the xmonad mailing list