aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 [])