mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-26 00:53:47 -07:00
HintedTile: orientation bug fix, remove wide and tall in favor of the Tall and Wide constructors.
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
module XMonad.Layout.HintedTile (
|
module XMonad.Layout.HintedTile (
|
||||||
-- * Usage
|
-- * Usage
|
||||||
-- $usage
|
-- $usage
|
||||||
tall, wide ) where
|
HintedTile(..), Orientation(..)) where
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Layouts ( Resize(..), IncMasterN(..) )
|
import XMonad.Layouts ( Resize(..), IncMasterN(..) )
|
||||||
@@ -35,25 +35,21 @@ import Control.Monad.Reader
|
|||||||
--
|
--
|
||||||
-- Then edit your @layoutHook@ by adding the HintedTile layout:
|
-- Then edit your @layoutHook@ by adding the HintedTile layout:
|
||||||
--
|
--
|
||||||
-- > myLayouts = tall 1 0.1 0.5 ||| Full ||| etc..
|
-- > myLayouts = HintedTile 1 0.1 0.5 Tall ||| Full ||| etc..
|
||||||
-- > main = xmonad dafaultConfig { layoutHook = myLayouts }
|
-- > main = xmonad dafaultConfig { layoutHook = myLayouts }
|
||||||
--
|
--
|
||||||
-- For more detailed instructions on editing the layoutHook see:
|
-- For more detailed instructions on editing the layoutHook see:
|
||||||
--
|
--
|
||||||
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
|
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
|
||||||
|
|
||||||
data HintedTile a =
|
data HintedTile a = HintedTile
|
||||||
HT { nmaster :: Int
|
{ nmaster :: Int
|
||||||
, delta, frac :: Rational
|
, delta, frac :: Rational
|
||||||
, orientation :: Orientation
|
, orientation :: Orientation
|
||||||
} deriving ( Show, Read )
|
} deriving ( Show, Read )
|
||||||
|
|
||||||
data Orientation = Wide | Tall deriving ( Show, Read )
|
data Orientation = Wide | Tall deriving ( Show, Read )
|
||||||
|
|
||||||
tall, wide :: Int -> Rational -> Rational -> HintedTile Window
|
|
||||||
wide n d f = HT {nmaster = n, delta = d, frac = f, orientation = Tall }
|
|
||||||
tall n d f = HT {nmaster = n, delta = d, frac = f, orientation = Wide }
|
|
||||||
|
|
||||||
instance LayoutClass HintedTile Window where
|
instance LayoutClass HintedTile Window where
|
||||||
doLayout c rect w' = let w = W.integrate w'
|
doLayout c rect w' = let w = W.integrate w'
|
||||||
in do { hints <- sequence (map getHints w)
|
in do { hints <- sequence (map getHints w)
|
||||||
@@ -63,8 +59,8 @@ instance LayoutClass HintedTile Window where
|
|||||||
where
|
where
|
||||||
(split, divide) =
|
(split, divide) =
|
||||||
case orientation c of
|
case orientation c of
|
||||||
Wide -> (splitHorizontally, divideHorizontally)
|
Tall -> (splitHorizontally, divideVertically)
|
||||||
Tall -> (splitVertically, divideVertically )
|
Wide -> (splitVertically, divideHorizontally)
|
||||||
tiler b f r masters slaves =
|
tiler b f r masters slaves =
|
||||||
if null masters || null slaves
|
if null masters || null slaves
|
||||||
then divide b (masters ++ slaves) r
|
then divide b (masters ++ slaves) r
|
||||||
|
Reference in New Issue
Block a user