mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
flip GridRatio to match convention (x/y)
This commit is contained in:
parent
bf51c0f64c
commit
ae57d452be
@ -36,7 +36,7 @@ import XMonad.StackSet
|
|||||||
-- You can also specify an aspect ratio for Grid to strive for with the
|
-- You can also specify an aspect ratio for Grid to strive for with the
|
||||||
-- GridRatio constructor:
|
-- GridRatio constructor:
|
||||||
--
|
--
|
||||||
-- > myLayouts = GridRatio (3/4) ||| etc.
|
-- > myLayouts = GridRatio (4/3) ||| etc.
|
||||||
--
|
--
|
||||||
-- For more detailed instructions on editing the layoutHook see:
|
-- For more detailed instructions on editing the layoutHook see:
|
||||||
--
|
--
|
||||||
@ -45,7 +45,7 @@ import XMonad.StackSet
|
|||||||
data Grid a = Grid | GridRatio Double deriving (Read, Show)
|
data Grid a = Grid | GridRatio Double deriving (Read, Show)
|
||||||
|
|
||||||
defaultRatio :: Double
|
defaultRatio :: Double
|
||||||
defaultRatio = 9/16
|
defaultRatio = 16/9
|
||||||
|
|
||||||
instance LayoutClass Grid a where
|
instance LayoutClass Grid a where
|
||||||
pureLayout Grid r = pureLayout (GridRatio defaultRatio) r
|
pureLayout Grid r = pureLayout (GridRatio defaultRatio) r
|
||||||
@ -55,7 +55,7 @@ arrange :: Double -> Rectangle -> [a] -> [(a, Rectangle)]
|
|||||||
arrange aspectRatio (Rectangle rx ry rw rh) st = zip st rectangles
|
arrange aspectRatio (Rectangle rx ry rw rh) st = zip st rectangles
|
||||||
where
|
where
|
||||||
nwins = length st
|
nwins = length st
|
||||||
ncols = max 1 . round . sqrt $ aspectRatio * fromIntegral nwins * fromIntegral rw / fromIntegral rh
|
ncols = max 1 . round . sqrt $ fromIntegral nwins * fromIntegral rw / (fromIntegral rh * aspectRatio)
|
||||||
mincs = nwins `div` ncols
|
mincs = nwins `div` ncols
|
||||||
extrs = nwins - ncols * mincs
|
extrs = nwins - ncols * mincs
|
||||||
chop :: Int -> Dimension -> [(Position, Dimension)]
|
chop :: Int -> Dimension -> [(Position, Dimension)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user