aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-06-12 15:37:27 +0200
committerDavid Roundy <droundy@darcs.net>2007-06-12 15:37:27 +0200
commitdf36367721a4ad1d957af634e92bbdd12adf3b41 (patch)
tree6a856b4638b116053ef19d3dc5a1cd67d4de4360
parentf0acb2ef136cb269da499a67004459b4e14fbb02 (diff)
downloadXMonadContrib-df36367721a4ad1d957af634e92bbdd12adf3b41.tar.gz
XMonadContrib-df36367721a4ad1d957af634e92bbdd12adf3b41.tar.xz
XMonadContrib-df36367721a4ad1d957af634e92bbdd12adf3b41.zip
new module NoBorders to let a given layout have windows without borders.
This is designed for layouts like full and tabbed, where the red square around the screen actually conveys no information (except for weird windows that use the shape extension or something, so that more than one window is actually visible). Save some real estate at no cost. darcs-hash:20070612133727-72aca-f82436aef1e122ce19bafd5be4fffbc9fc56e904.gz
-rw-r--r--MetaModule.hs1
-rw-r--r--NoBorders.hs36
2 files changed, 37 insertions, 0 deletions
diff --git a/MetaModule.hs b/MetaModule.hs
index 7ca8c5e..033ece9 100644
--- a/MetaModule.hs
+++ b/MetaModule.hs
@@ -23,6 +23,7 @@ import XMonadContrib.HintedTile ()
import XMonadContrib.LayoutHints ()
import XMonadContrib.Mosaic ()
import XMonadContrib.NamedWindows ()
+import XMonadContrib.NoBorders ()
import XMonadContrib.RotView ()
import XMonadContrib.SimpleDate ()
import XMonadContrib.Spiral ()
diff --git a/NoBorders.hs b/NoBorders.hs
new file mode 100644
index 0000000..1b8ae94
--- /dev/null
+++ b/NoBorders.hs
@@ -0,0 +1,36 @@
+module XMonadContrib.NoBorders ( noBorders, withBorder ) where
+
+-- Make a given layout display without borders. This is useful for
+-- full-screen or tabbed layouts, where you don't really want to waste a
+-- couple of pixels of real estate just to inform yourself that the visible
+-- window has focus.
+
+-- Usage:
+
+-- import XMonadContrib.NoBorders
+
+-- layouts = [ noBorders full, tall, ... ]
+
+import Control.Monad.State ( gets )
+import Graphics.X11.Xlib
+
+import XMonad
+import Operations ( UnDoLayout(UnDoLayout) )
+import qualified StackSet as W
+import {-# SOURCE #-} Config (borderWidth)
+
+noBorders :: Layout -> Layout
+noBorders = withBorder 0
+
+withBorder :: Dimension -> Layout -> Layout
+withBorder bd l = l { doLayout = \r x -> setborders bd >> doLayout l r x
+ , modifyLayout = ml }
+ where ml m | Just UnDoLayout == fromMessage m
+ = do setborders borderWidth
+ fmap (withBorder bd) `fmap` (modifyLayout l) m
+ | otherwise = fmap (withBorder bd) `fmap` (modifyLayout l) m
+
+setborders :: Dimension -> X ()
+setborders bw = withDisplay $ \d ->
+ do ws <- gets (W.integrate . W.stack . W.workspace . W.current . windowset)
+ mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws