mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
add clear window message in Mosaic.
This commit is contained in:
parent
75df3884fa
commit
0ad1ae70d9
10
Mosaic.hs
10
Mosaic.hs
@ -1,4 +1,4 @@
|
||||
module XMonadContrib.Mosaic ( mosaic, expandWindow, shrinkWindow, squareWindow,
|
||||
module XMonadContrib.Mosaic ( mosaic, expandWindow, shrinkWindow, squareWindow, myclearWindow,
|
||||
getName, withNamedWindow ) where
|
||||
|
||||
-- This module defines a "mosaic" layout, which tries to give all windows
|
||||
@ -24,6 +24,7 @@ module XMonadContrib.Mosaic ( mosaic, expandWindow, shrinkWindow, squareWindow,
|
||||
-- , ((modMask .|. shiftMask, xK_h ), withNamedWindow (sendMessage . shrinkWindow))
|
||||
-- , ((modMask .|. shiftMask, xK_l ), withNamedWindow (sendMessage . expandWindow))
|
||||
-- , ((modMask .|. shiftMask, xK_s ), withNamedWindow (sendMessage . squareWindow))
|
||||
-- , ((modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . clearWindow))
|
||||
|
||||
import Control.Monad.Reader ( asks )
|
||||
import Control.Monad.State ( gets )
|
||||
@ -40,15 +41,17 @@ import Control.Monad ( mplus )
|
||||
|
||||
import System.IO.Unsafe
|
||||
|
||||
data HandleWindow = ExpandWindow NamedWindow | ShrinkWindow NamedWindow | SquareWindow NamedWindow
|
||||
data HandleWindow = ExpandWindow NamedWindow | ShrinkWindow NamedWindow
|
||||
| SquareWindow NamedWindow | ClearWindow NamedWindow
|
||||
deriving ( Typeable, Eq )
|
||||
|
||||
instance Message HandleWindow
|
||||
|
||||
expandWindow, shrinkWindow, squareWindow :: NamedWindow -> HandleWindow
|
||||
expandWindow, shrinkWindow, squareWindow, myclearWindow :: NamedWindow -> HandleWindow
|
||||
expandWindow = ExpandWindow
|
||||
shrinkWindow = ShrinkWindow
|
||||
squareWindow = SquareWindow
|
||||
myclearWindow = ClearWindow
|
||||
|
||||
largeNumber :: Int
|
||||
largeNumber = 1000
|
||||
@ -66,6 +69,7 @@ mosaic delta tileFrac raters areas = Layout { doLayout = mosaicL tileFrac raters
|
||||
-- (add_rater (\_ (Rectangle _ _ wid h) -> delta*(wid///h-1)) w raters)
|
||||
(multiply_area (1/(1+ delta)) w areas)
|
||||
m2 (SquareWindow w) = mosaic delta tileFrac (M.insert w force_square raters) areas
|
||||
m2 (ClearWindow w) = mosaic delta tileFrac (M.delete w raters) (M.delete w areas)
|
||||
force_square _ (Rectangle _ _ a b) = 100*(sqr(a///b) + sqr(b///a))
|
||||
sqr a = a * a
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user