aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-09-29 03:09:46 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-09-29 03:09:46 +0200
commit9697f1792eca6bd968c4abed7adda45b37236305 (patch)
tree38ef2f9695809e191af67d5f280a5e975bfba742
parentcc8958f3d6c86939982650f4b2a739e51f025028 (diff)
downloadXMonadContrib-9697f1792eca6bd968c4abed7adda45b37236305.tar.gz
XMonadContrib-9697f1792eca6bd968c4abed7adda45b37236305.tar.xz
XMonadContrib-9697f1792eca6bd968c4abed7adda45b37236305.zip
Add smartBorders
darcs-hash:20070929010946-a5988-c2b8952b46d30c05e1ec88d692d312b464de4f01.gz
-rw-r--r--NoBorders.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/NoBorders.hs b/NoBorders.hs
index e6b3a24..df0167d 100644
--- a/NoBorders.hs
+++ b/NoBorders.hs
@@ -21,6 +21,7 @@ module XMonadContrib.NoBorders (
-- * Usage
-- $usage
noBorders,
+ smartBorders,
withBorder
) where
@@ -70,3 +71,23 @@ withBorder b = ModifiedLayout $ WithBorder b []
setBorders :: Dimension -> [Window] -> X ()
setBorders bw ws = withDisplay $ \d -> mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws
+
+data SmartBorder a = SmartBorder [a] deriving (Read, Show)
+
+instance LayoutModifier SmartBorder Window where
+ modifierDescription _ = "SmartBorder"
+
+ unhook (SmartBorder s) = setBorders borderWidth s
+
+ redoLayout (SmartBorder s) _ stack wrs = do
+ ss <- gets (W.screens . windowset)
+ setBorders borderWidth s
+
+ if singleton ws && singleton ss
+ then do setBorders 0 ws; return (wrs, Just $ SmartBorder ws)
+ else return (wrs, Just $ SmartBorder [])
+ where
+ ws = map fst wrs
+ singleton = null . drop 1
+
+smartBorders = ModifiedLayout (SmartBorder [])