aboutsummaryrefslogtreecommitdiffstats
path: root/Tabbed.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-06-11 03:54:37 +0200
committerJason Creighton <jcreigh@gmail.com>2007-06-11 03:54:37 +0200
commitaacba82c15c390c980a62a4bebf7b1d0244ecd9a (patch)
tree0ad3224278d96c178f9d559d0a1ba2c974476e96 /Tabbed.hs
parent252d55826ac2ddcf879d8cbf8a5af2d63b043fef (diff)
downloadXMonadContrib-aacba82c15c390c980a62a4bebf7b1d0244ecd9a.tar.gz
XMonadContrib-aacba82c15c390c980a62a4bebf7b1d0244ecd9a.tar.xz
XMonadContrib-aacba82c15c390c980a62a4bebf7b1d0244ecd9a.zip
use safe peek instead of unsafe focus
Fixes crashing bug with Xinerama where you have a tabbed layout on one screen and attempt to switch to an empty workspace on the other. darcs-hash:20070611015437-b9aa7-19e093acecdf9c248a965625b226b82b1422ffd0.gz
Diffstat (limited to 'Tabbed.hs')
-rw-r--r--Tabbed.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/Tabbed.hs b/Tabbed.hs
index 6eaa754..d88077a 100644
--- a/Tabbed.hs
+++ b/Tabbed.hs
@@ -10,7 +10,7 @@ module XMonadContrib.Tabbed ( tabbed ) where
-- defaultLayouts = [ tabbed
-- , ... ]
-import Control.Monad ( forM )
+import Control.Monad ( forM, liftM )
import Control.Monad.State ( gets )
import Graphics.X11.Xlib
@@ -32,8 +32,7 @@ dolay sc@(Rectangle x y wid _) ws =
maketab (t,w) = newDecoration t 1 0x000000 0x777777 (drawtab t w) (focus w)
drawtab r@(Rectangle _ _ wt ht) w d w' gc =
do nw <- getName w
- focusw <- gets (W.focus . W.stack . W.workspace . W.current . windowset)
- let tabcolor = if focusw == w then 0xBBBBBB else 0x888888
+ tabcolor <- (maybe 0x888888 (\focusw -> if focusw == w then 0xBBBBBB else 0x888888) . W.peek) `liftM` gets windowset
io $ setForeground d gc tabcolor
io $ fillRectangles d w' gc [Rectangle 0 0 wt ht]
io $ setForeground d gc 0x000000