mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-09-01 11:53:48 -07:00
Make LayoutHints a decoration aware layout modifier
This commit is contained in:
@@ -24,7 +24,7 @@ module XMonad.Layout.Decoration
|
|||||||
, shrinkText, CustomShrink ( CustomShrink )
|
, shrinkText, CustomShrink ( CustomShrink )
|
||||||
, Shrinker (..), DefaultShrinker
|
, Shrinker (..), DefaultShrinker
|
||||||
, module XMonad.Layout.LayoutModifier
|
, module XMonad.Layout.LayoutModifier
|
||||||
, fi
|
, isDecoration, fi
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
@@ -215,6 +215,9 @@ updateDeco sh c fs ((w,_),(dw,Just (Rectangle _ _ wh ht))) = do
|
|||||||
paintAndWrite dw fs wh ht 1 bc borderc tc bc AlignCenter name
|
paintAndWrite dw fs wh ht 1 bc borderc tc bc AlignCenter name
|
||||||
updateDeco _ _ _ (_,(w,Nothing)) = hideWindow w
|
updateDeco _ _ _ (_,(w,Nothing)) = hideWindow w
|
||||||
|
|
||||||
|
isDecoration :: Window -> X Bool
|
||||||
|
isDecoration w = withDisplay (io . flip getWindowAttributes w) >>= return . wa_override_redirect
|
||||||
|
|
||||||
shrinkWhile :: (String -> [String]) -> (String -> X Bool) -> String -> X String
|
shrinkWhile :: (String -> [String]) -> (String -> X Bool) -> String -> X String
|
||||||
shrinkWhile sh p x = sw $ sh x
|
shrinkWhile sh p x = sw $ sh x
|
||||||
where sw [n] = return n
|
where sw [n] = return n
|
||||||
|
@@ -21,7 +21,7 @@ module XMonad.Layout.LayoutHints (
|
|||||||
|
|
||||||
import XMonad hiding ( trace )
|
import XMonad hiding ( trace )
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
|
import XMonad.Layout.Decoration ( isDecoration )
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||||
--
|
--
|
||||||
@@ -54,8 +54,9 @@ instance LayoutModifier LayoutHints Window where
|
|||||||
xs' <- mapM (applyHint bW) xs
|
xs' <- mapM (applyHint bW) xs
|
||||||
return (xs', Nothing)
|
return (xs', Nothing)
|
||||||
where
|
where
|
||||||
applyHint bW (w,Rectangle a b c d) =
|
applyHint bW (w,r@(Rectangle a b c d)) =
|
||||||
withDisplay $ \disp -> do
|
withDisplay $ \disp -> do
|
||||||
|
isd <- isDecoration w
|
||||||
sh <- io $ getWMNormalHints disp w
|
sh <- io $ getWMNormalHints disp w
|
||||||
let (c',d') = adjBorders 1 bW . applySizeHints sh . adjBorders bW (-1) $ (c,d)
|
let (c',d') = adjBorders 1 bW . applySizeHints sh . adjBorders bW (-1) $ (c,d)
|
||||||
return (w, Rectangle a b c' d')
|
return (w, if isd then r else Rectangle a b c' d')
|
||||||
|
Reference in New Issue
Block a user