[Xmonad] why no refresh on focus events?

David Glasser glasser at mit.edu
Thu May 31 18:32:09 EDT 2007


I'm working on an "accordion" layout in which the layout depends on
which window is focused.  (Basically: the focused window takes up most
of the screen; the windows before it in the list are strips on the
top, and the windows after it are strips on the bottom.)

It mostly works, but only when you use focus changes that go through
the "windows" function; when a window is focused by mouse-over,
nothing happens.  This is because of the patch quoted below, which
doesn't refresh when you call "focus".  I'm wondering what the problem
caused by that refresh was, and if there's another way to fix it?

(Also, the current doLayout signature is pretty restrictive.  It would
be nice if it was told the workspace ID of the workspace it is laying
out; that way it can get the windowset from the X state and, say, find
out what the top window of the workspace being laid out is; W.peek
just gives you the focused window of the entire StackSet.)

--dave

Mon May 28 09:31:27 EDT 2007  Don Stewart <dons at cse.unsw.edu.au>
  * don't refresh on focus events

  leads to a race. this will affect how gaps are redrawn when moving to a
  new screen with the mouse.

diff -rN -u old-xmonad/Operations.hs new-xmonad/Operations.hs
--- old-xmonad/Operations.hs	2007-05-31 18:22:36.000000000 -0400
+++ new-xmonad/Operations.hs	2007-05-31 18:22:36.000000000 -0400
@@ -220,7 +220,7 @@
 -- the mouse to a new screen).
 focus :: Window -> X ()
 focus w = withWorkspace $ \s -> do
-    if W.member w s then modify (\st -> st { windowset =
W.focusWindow w s }) >> refresh
+    if W.member w s then modify (\st -> st { windowset =
W.focusWindow w s }) -- >> refresh
                     else whenX (isRoot w) $ setFocusX w -- we could
refresh here, moving gap too.
     -- XXX a focus change could be caused by switching workspaces in xinerama.
     -- if so, and the gap is in use, the gap should probably follow the



-- 
David Glasser | glasser at mit.edu | http://www.davidglasser.net/


More information about the Xmonad mailing list