From 7802891028dff79e7bfb14eaaaaf9ee5ebe312f3 Mon Sep 17 00:00:00 2001 From: David Roundy Date: Thu, 8 Nov 2007 18:52:50 +0100 Subject: fix bug in avoidStruts. I've now tested this module, and it works on x86--but doesn't work on x86-64, because ManageDocks doesn't work on 64-bit. But in any case, it works almost perfectly, with no user intervention needed (and no special hooks). The only catch is that it doesn't notice when a panel disappears, so the layout won't adjust until the next refresh (e.g. if you change focus, layout or workspace). darcs-hash:20071108175250-72aca-13b5c836f9b263465aee9fe7a5f1b1e875eb8f60.gz --- XMonad/Hooks/ManageDocks.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'XMonad/Hooks/ManageDocks.hs') diff --git a/XMonad/Hooks/ManageDocks.hs b/XMonad/Hooks/ManageDocks.hs index 481c047..09e52e2 100644 --- a/XMonad/Hooks/ManageDocks.hs +++ b/XMonad/Hooks/ManageDocks.hs @@ -16,6 +16,19 @@ -- It also allows you to reset the gap to reflect the state of current STRUT -- windows (for example, after you resized or closed a panel), and to toggle the Gap -- in a STRUT-aware fashion. + +-- The avoidStruts layout modifier allows you to make xmonad dynamically +-- avoid overlapping windows with panels. You can (optionally) enable this +-- on a selective basis, so that some layouts will effectively hide the +-- panel, by placing windows on top of it. An example use of avoidStruts +-- would be: + +-- > layoutHook = Layout $ toggleLayouts (noBorders Full) $ avoidStruts $ +-- > your actual layouts here ||| ... + +-- This would enable a full-screen mode that overlaps the panel, while all +-- other layouts avoid the panel. + ----------------------------------------------------------------------------- module XMonad.Hooks.ManageDocks ( -- * Usage @@ -144,7 +157,7 @@ data AvoidStruts l a = AvoidStruts (l a) deriving ( Read, Show ) instance LayoutClass l a => LayoutClass (AvoidStruts l) a where doLayout (AvoidStruts lo) (Rectangle x y w h) s = do (t,l,b,r) <- calcGap - let rect = Rectangle (x+10+fromIntegral l) (y+fromIntegral t) + let rect = Rectangle (x+fromIntegral l) (y+fromIntegral t) (w-fromIntegral l-fromIntegral r) (h-fromIntegral t-fromIntegral b) (wrs,mlo') <- doLayout lo rect s return (wrs, AvoidStruts `fmap` mlo') -- cgit v1.2.3