diff options
author | daedalusinfinity <daedalusinfinity@gmail.com> | 2012-09-23 05:45:27 +0200 |
---|---|---|
committer | daedalusinfinity <daedalusinfinity@gmail.com> | 2012-09-23 05:45:27 +0200 |
commit | cabf7d96ae1026e5f69a106f5cabe4c183c30298 (patch) | |
tree | 7ce85351753c5cf415d6af8ac9dee43102199435 | |
parent | 3df90f839d52616f7460f4c92f40921b8bf9cd02 (diff) | |
download | XMonadContrib-cabf7d96ae1026e5f69a106f5cabe4c183c30298.tar.gz XMonadContrib-cabf7d96ae1026e5f69a106f5cabe4c183c30298.tar.xz XMonadContrib-cabf7d96ae1026e5f69a106f5cabe4c183c30298.zip |
Added smart spacing to the spacing module
Ignore-this: 9104bc8feb832f63f2f18998c0f7ba92
Added smart spacing to the spacing module, which adds spacing to all windows,
except to windows on singleton workspaces.
darcs-hash:20120923034527-6243b-e3036a0e7e350648026148a4ff0d25db40358e52.gz
Diffstat (limited to '')
-rw-r--r-- | XMonad/Layout/Spacing.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/XMonad/Layout/Spacing.hs b/XMonad/Layout/Spacing.hs index 6a2ba2c..609c858 100644 --- a/XMonad/Layout/Spacing.hs +++ b/XMonad/Layout/Spacing.hs @@ -18,6 +18,7 @@ module XMonad.Layout.Spacing ( -- $usage spacing, Spacing, + smartSpacing, SmartSpacing, ) where @@ -52,3 +53,17 @@ instance LayoutModifier Spacing a where shrinkRect :: Int -> Rectangle -> Rectangle shrinkRect p (Rectangle x y w h) = Rectangle (x+fi p) (y+fi p) (w-2*fi p) (h-2*fi p) + +-- | Surrounds all windows with blank space, except when the window is the only +-- visible window on the current workspace. +smartSpacing :: Int -> l a -> ModifiedLayout SmartSpacing l a +smartSpacing p = ModifiedLayout (SmartSpacing p) + +data SmartSpacing a = SmartSpacing Int deriving (Show, Read) + +instance LayoutModifier SmartSpacing a where + + pureModifier _ _ _ [x] = ([x], Nothing) + pureModifier (SmartSpacing p) _ _ wrs = (map (second $ shrinkRect p) wrs, Nothing) + + modifierDescription (SmartSpacing p) = "SmartSpacing " ++ show p |