diff options
author | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-11-01 08:08:59 +0100 |
---|---|---|
committer | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-11-01 08:08:59 +0100 |
commit | 7f808d530741b5908a4cd4e9b6653b25ffc6077c (patch) | |
tree | 3573940c6b2aa1a27cfa81a3d53c4fa5d0b6abc1 | |
parent | f97bbee409d059060b12808686100fc05f5c07be (diff) | |
download | XMonadContrib-7f808d530741b5908a4cd4e9b6653b25ffc6077c.tar.gz XMonadContrib-7f808d530741b5908a4cd4e9b6653b25ffc6077c.tar.xz XMonadContrib-7f808d530741b5908a4cd4e9b6653b25ffc6077c.zip |
Port NoBorders
darcs-hash:20071101070859-a5988-e90cdb1202e4a891d0f78ae3948e0a0c15413284.gz
-rw-r--r-- | NoBorders.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/NoBorders.hs b/NoBorders.hs index f9a9751..5c54814 100644 --- a/NoBorders.hs +++ b/NoBorders.hs @@ -25,12 +25,12 @@ module XMonadContrib.NoBorders ( withBorder ) where -import Control.Monad.State ( gets ) +import Control.Monad.State (gets) +import Control.Monad.Reader (asks) import Graphics.X11.Xlib import XMonad import XMonadContrib.LayoutModifier -import {-# SOURCE #-} Config (borderWidth) import qualified StackSet as W import Data.List ((\\)) @@ -43,7 +43,7 @@ import Data.List ((\\)) -- borders -- -- > layouts = [ Layout (noBorders Full), ... ] --- +-- -- %import XMonadContrib.NoBorders -- %layout -- prepend noBorders to default layouts above to remove their borders, like so: @@ -56,11 +56,11 @@ instance LayoutModifier WithBorder Window where modifierDescription (WithBorder 0 _) = "NoBorders" modifierDescription (WithBorder n _) = "Borders " ++ show n - unhook (WithBorder _ s) = setBorders borderWidth s + unhook (WithBorder _ s) = asks borderWidth >>= setBorders s redoLayout (WithBorder n s) _ _ wrs = do - setBorders borderWidth (s \\ ws) - setBorders n ws + asks borderWidth >>= setBorders (s \\ ws) + setBorders ws n return (wrs, Just $ WithBorder n ws) where ws = map fst wrs @@ -71,26 +71,26 @@ noBorders = ModifiedLayout $ WithBorder 0 [] withBorder :: LayoutClass l a => Dimension -> l a -> ModifiedLayout WithBorder l a withBorder b = ModifiedLayout $ WithBorder b [] -setBorders :: Dimension -> [Window] -> X () -setBorders bw ws = withDisplay $ \d -> mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws +setBorders :: [Window] -> Dimension -> X () +setBorders ws bw = 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 + unhook (SmartBorder s) = asks borderWidth >>= setBorders s redoLayout (SmartBorder s) _ _ wrs = do ss <- gets (W.screens . windowset) if singleton ws && singleton ss then do - setBorders borderWidth (s \\ ws) - setBorders 0 ws + asks borderWidth >>= setBorders (s \\ ws) + setBorders ws 0 return (wrs, Just $ SmartBorder ws) else do - setBorders borderWidth s + asks borderWidth >>= setBorders s return (wrs, Just $ SmartBorder []) where ws = map fst wrs |