aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-06-05 10:37:35 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-06-05 10:37:35 +0200
commit66deb9dbfb0cbbe4a363db34ca43ceb849d0c020 (patch)
tree14716a80ea1d19964d41a84b2d13bc2d19faf0b2
parentf760df0ddce1297c576383e6a25f423a90c93699 (diff)
downloadxmonad-66deb9dbfb0cbbe4a363db34ca43ceb849d0c020.tar.gz
xmonad-66deb9dbfb0cbbe4a363db34ca43ceb849d0c020.tar.xz
xmonad-66deb9dbfb0cbbe4a363db34ca43ceb849d0c020.zip
Enable logging of state changes to stdout
darcs-hash:20070605083735-9c5c1-1ab5acbd611914caa7b5cdf1f2df338c0ee616f8.gz
-rw-r--r--Config.hs7
-rw-r--r--Config.hs-boot1
-rw-r--r--Main.hs3
-rw-r--r--Operations.hs6
4 files changed, 13 insertions, 4 deletions
diff --git a/Config.hs b/Config.hs
index fc941db..b420418 100644
--- a/Config.hs
+++ b/Config.hs
@@ -100,6 +100,13 @@ defaultLayouts = [ tiled , mirror tiled , full ]
delta = 3%100
--
+-- Enable logging of state changes to stdout.
+-- The internal state of the window manager is 'shown' in Haskell data format
+--
+logging :: Bool
+logging = False
+
+--
-- The key bindings list.
--
-- The unusual comment format is used to generate the documentation
diff --git a/Config.hs-boot b/Config.hs-boot
index 2d66ae1..b6868aa 100644
--- a/Config.hs-boot
+++ b/Config.hs-boot
@@ -1,3 +1,4 @@
module Config where
import Graphics.X11.Xlib.Types (Dimension)
borderWidth :: Dimension
+logging :: Bool
diff --git a/Main.hs b/Main.hs
index 8c9b485..1b2e42f 100644
--- a/Main.hs
+++ b/Main.hs
@@ -45,6 +45,7 @@ main = do
xinesc <- getScreenInfo dpy
nbc <- initcolor normalBorderColor
fbc <- initcolor focusedBorderColor
+ hSetBuffering stdout NoBuffering
args <- getArgs
let winset | ("--resume" : s : _) <- args
@@ -89,7 +90,7 @@ main = do
, w <- W.integrate (W.stack wk) ]
mapM_ manage ws -- find new windows
- -- withWindowSet (io . hPrint stderr) -- uncomment for state logging
+ when logging $ withWindowSet (io . hPrint stdout)
-- main loop, for all you HOF/recursion fans out there.
forever $ handle =<< io (nextEvent dpy e >> getEvent e)
diff --git a/Operations.hs b/Operations.hs
index 93c0da0..734935d 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -15,7 +15,7 @@ module Operations where
import XMonad
import qualified StackSet as W
-import {-# SOURCE #-} Config (borderWidth)
+import {-# SOURCE #-} Config (borderWidth,logging)
import Data.Maybe
import Data.List (genericIndex, intersectBy, partition, delete)
@@ -168,8 +168,8 @@ windows f = do
io $ restackWindows d (flt ++ tiled')
setTopFocus
- -- withWindowSet (io . hPrint stderr) -- logging state changes!
- -- io performGC -- really helps
+ when logging $ withWindowSet (io . hPrint stdout)
+ -- io performGC -- really helps, but seems to trigger GC bugs?
-- We now go to some effort to compute the minimal set of windows to hide.
-- The minimal set being only those windows which weren't previously hidden,