mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 20:51:52 -07:00
Various fixes to NoBorders. Hopefully fixes bug #42
This commit is contained in:
32
NoBorders.hs
32
NoBorders.hs
@@ -1,3 +1,5 @@
|
|||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- |
|
-- |
|
||||||
-- Module : XMonadContrib.NoBorders
|
-- Module : XMonadContrib.NoBorders
|
||||||
@@ -44,19 +46,27 @@ import qualified StackSet as W
|
|||||||
-- %layout -- prepend noBorders to default layouts above to remove their borders, like so:
|
-- %layout -- prepend noBorders to default layouts above to remove their borders, like so:
|
||||||
-- %layout , noBorders full
|
-- %layout , noBorders full
|
||||||
|
|
||||||
data WithBorder a = WithBorder Dimension deriving ( Read, Show )
|
-- todo, use an InvisibleList.
|
||||||
|
data WithBorder a = WithBorder Dimension [a] deriving ( Read, Show )
|
||||||
|
|
||||||
instance LayoutModifier WithBorder a where
|
instance LayoutModifier WithBorder Window where
|
||||||
hook (WithBorder b) = setborders b
|
modifierDescription (WithBorder 0 _) = "NoBorders"
|
||||||
unhook (WithBorder _) = setborders borderWidth
|
modifierDescription (WithBorder n _) = "Borders " ++ show n
|
||||||
|
|
||||||
noBorders :: Layout l a => l a -> ModifiedLayout WithBorder l a
|
unhook (WithBorder _ s) = setBorders borderWidth s
|
||||||
noBorders = ModifiedLayout (WithBorder 0)
|
|
||||||
|
redoLayout (WithBorder n s) _ stack wrs = do
|
||||||
|
setBorders borderWidth s
|
||||||
|
setBorders n ws
|
||||||
|
return (wrs, Just $ WithBorder n ws)
|
||||||
|
where
|
||||||
|
ws = map fst wrs
|
||||||
|
|
||||||
|
noBorders :: Layout l Window => l Window -> ModifiedLayout WithBorder l Window
|
||||||
|
noBorders = ModifiedLayout $ WithBorder 0 []
|
||||||
|
|
||||||
withBorder :: Layout l a => Dimension -> l a -> ModifiedLayout WithBorder l a
|
withBorder :: Layout l a => Dimension -> l a -> ModifiedLayout WithBorder l a
|
||||||
withBorder b = ModifiedLayout (WithBorder b)
|
withBorder b = ModifiedLayout $ WithBorder b []
|
||||||
|
|
||||||
setborders :: Dimension -> X ()
|
setBorders :: Dimension -> [Window] -> X ()
|
||||||
setborders bw = withDisplay $ \d ->
|
setBorders bw ws = withDisplay $ \d -> mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws
|
||||||
do ws <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
|
|
||||||
mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws
|
|
||||||
|
Reference in New Issue
Block a user