LayoutCombinators: changes infixes and added many other combinators.

This commit is contained in:
Andrea Rossato 2007-11-27 16:18:07 +00:00
parent d5533e4dec
commit cc1a24c1c8
2 changed files with 98 additions and 71 deletions

View File

@ -133,9 +133,9 @@ config = defaultConfig
, layoutHook = workspaceDir "~" $ windowNavigation $ , layoutHook = workspaceDir "~" $ windowNavigation $
toggleLayouts (noBorders Full) $ -- avoidStruts $ toggleLayouts (noBorders Full) $ -- avoidStruts $
Named "tabbed" (noBorders mytab) ||| Named "tabbed" (noBorders mytab) |||
Named "xclock" (mytab <-//> combineTwo Square mytab mytab) ||| Named "xclock" (mytab **//* combineTwo Square mytab mytab) |||
Named "widescreen" ((mytab XMonad.Layout.LayoutCombinators.<||> mytab) Named "widescreen" ((mytab *||* mytab)
<-//> combineTwo Square mytab mytab) ||| **//* combineTwo Square mytab mytab) |||
mosaic 0.25 0.5 mosaic 0.25 0.5
, terminal = "xterm" -- The preferred terminal program. , terminal = "xterm" -- The preferred terminal program.
, normalBorderColor = "#dddddd" -- Border color for unfocused windows. , normalBorderColor = "#dddddd" -- Border color for unfocused windows.

View File

@ -16,10 +16,29 @@
module XMonad.Layout.LayoutCombinators ( module XMonad.Layout.LayoutCombinators (
-- * Usage -- * Usage
-- $usage -- $usage
(<||>),(<-||>),(<||->),
(<//>),(<-//>),(<//->), -- * Combinators using DragPane vertical
(<|>),(<-|>),(<|->), -- $dpv
(</>),(<-/>),(</->), (*||*), (**||*),(***||*),(****||*),(***||**),(****||***),
(***||****),(*||****),(**||***),(*||***),(*||**),
-- * Combinators using DragPane Horizontal
-- $dph
(*//*), (**//*),(***//*),(****//*),(***//**),(****//***),
(***//****),(*//****),(**//***),(*//***),(*//**),
-- * Combinators using Mirror Tall Vertical
-- $mtv
(*|*), (**|*),(***|*),(****|*),(***|**),(****|***),
(***|****),(*|****),(**|***),(*|***),(*|**),
-- * Combinators using Mirror Tall Horizontal
-- $mth
(*/*), (**/*),(***/*),(****/*),(***/**),(****/***),
(***/****),(*/****),(**/***),(*/***),(*/**),
-- * A new combinator
-- $nc
(|||), (|||),
JumpToLayout(JumpToLayout) JumpToLayout(JumpToLayout)
) where ) where
@ -38,89 +57,97 @@ import XMonad.Layout.DragPane
-- --
-- Then edit your @layoutHook@ by using the new layout combinators: -- Then edit your @layoutHook@ by using the new layout combinators:
-- --
-- > myLayouts = (Tall 1 (3/100) (1/2) <-/> Full) ||| (Tall 1 (3/100) (1/2) <||-> Full) ||| Full ||| etc.. -- > myLayouts = (Tall 1 (3/100) (1/2) *//* Full) ||| (Tall 1 (3/100) (1/2) ***||** Full) ||| Full ||| etc..
-- > main = xmonad defaultConfig { layoutHook = myLayouts } -- > main = xmonad defaultConfig { 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"
infixr 6 <||>, <//>, <-||>, <-//>, <||->, <//->, <|>, <-|>, <|->, </>, <-/>, </-> infixr 6 *||*, **||*, ***||*, ****||*, ***||**, ****||***, ***||****, *||****, **||***, *||***, *||**,
*//*, **//*, ***//*, ****//*, ***//**, ****//***, ***//****, *//****, **//***, *//***, *//**,
*|* , **|* , ***|* , ****|* , ***|** , ****|*** , ***|**** , *|**** , **|*** , *|*** , *|** ,
*/* , **/* , ***/* , ****/* , ***/** , ****/*** , ***/**** , */**** , **/*** , */*** , */**
-- | Combines two layouts vertically using dragPane -- $dpv
(<||>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) => -- These combinators combine 2 layouts using "XMonad.DragPane" in
-- vertical mode.
(*||*),(**||*),(***||*),(****||*), (***||**),(****||***),
(***||****),(*||****),(**||***),(*||***),(*||**) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) =>
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a
-- | Combines two layouts vertically using dragPane giving more screen (*||*) = combineTwo (dragPane Vertical 0.1 (1/2))
-- to the first layout (**||*) = combineTwo (dragPane Vertical 0.1 (2/3))
(<-||>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) => (***||*) = combineTwo (dragPane Vertical 0.1 (3/4))
(****||*) = combineTwo (dragPane Vertical 0.1 (4/5))
(***||**) = combineTwo (dragPane Vertical 0.1 (3/5))
(****||***) = combineTwo (dragPane Vertical 0.1 (4/7))
(***||****) = combineTwo (dragPane Vertical 0.1 (3/7))
(*||****) = combineTwo (dragPane Vertical 0.1 (1/5))
(**||***) = combineTwo (dragPane Vertical 0.1 (2/5))
(*||***) = combineTwo (dragPane Vertical 0.1 (1/4))
(*||**) = combineTwo (dragPane Vertical 0.1 (1/3))
-- $dph
-- These combinators combine 2 layouts using "XMonad.DragPane" in
-- horizontal mode.
(*//*),(**//*),(***//*),(****//*), (***//**),(****//***),
(***//****),(*//****),(**//***),(*//***),(*//**) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) =>
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a
-- | Combines two layouts vertically using dragPane giving more screen (*//*) = combineTwo (dragPane Horizontal 0.1 (1/2))
-- to the second layout (**//*) = combineTwo (dragPane Horizontal 0.1 (2/3))
(<||->) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) => (***//*) = combineTwo (dragPane Horizontal 0.1 (3/4))
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a (****//*) = combineTwo (dragPane Horizontal 0.1 (4/5))
(***//**) = combineTwo (dragPane Horizontal 0.1 (3/5))
(****//***) = combineTwo (dragPane Horizontal 0.1 (4/7))
(***//****) = combineTwo (dragPane Horizontal 0.1 (3/7))
(*//****) = combineTwo (dragPane Horizontal 0.1 (1/5))
(**//***) = combineTwo (dragPane Horizontal 0.1 (2/5))
(*//***) = combineTwo (dragPane Horizontal 0.1 (1/4))
(*//**) = combineTwo (dragPane Horizontal 0.1 (1/3))
-- | Combines two layouts horizzontally using dragPane -- $mtv
(<//>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) => -- These combinators combine two layouts vertivally using Mirror
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a -- Tall.
(*|*),(**|*),(***|*),(****|*), (***|**),(****|***),
-- | Combines two layouts horizzontally using dragPane giving more screen (***|****),(*|****),(**|***),(*|***),(*|**) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a)
-- to the first layout
(<-//>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) =>
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a
-- | Combines two layouts horizzontally using dragPane giving more screen
-- to the first layout
(<//->) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) =>
l1 a -> l2 a -> CombineTwo (DragPane ()) l1 l2 a
-- | Combines two layouts vertically using Tall
(<|>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a)
=> l1 a -> l2 a -> CombineTwo (Tall ()) l1 l2 a => l1 a -> l2 a -> CombineTwo (Tall ()) l1 l2 a
(*|*) = combineTwo (Tall 1 0.1 (1/2))
(**|*) = combineTwo (Tall 1 0.1 (2/3))
(***|*) = combineTwo (Tall 1 0.1 (3/4))
(****|*) = combineTwo (Tall 1 0.1 (4/5))
(***|**) = combineTwo (Tall 1 0.1 (3/5))
(****|***) = combineTwo (Tall 1 0.1 (4/7))
(***|****) = combineTwo (Tall 1 0.1 (3/7))
(*|****) = combineTwo (Tall 1 0.1 (1/5))
(**|***) = combineTwo (Tall 1 0.1 (2/5))
(*|***) = combineTwo (Tall 1 0.1 (1/4))
(*|**) = combineTwo (Tall 1 0.1 (1/3))
-- | Combines two layouts vertically using Tall giving more screen
-- to the first layout
(<-|>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a)
=> l1 a -> l2 a -> CombineTwo (Tall ()) l1 l2 a
-- | Combines two layouts vertically using Tall giving more screen -- $mtv
-- to the second layout -- These combinators combine two layouts horizzontally using Mirror
(<|->) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) -- Tall (a wide layout)
=> l1 a -> l2 a -> CombineTwo (Tall ()) l1 l2 a (*/*),(**/*),(***/*),(****/*), (***/**),(****/***),
(***/****),(*/****),(**/***),(*/***),(*/**) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a)
-- | Combines two layouts horizzontally using Mirror Tall (a wide
-- layout)
(</>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a)
=> l1 a -> l2 a -> CombineTwo (Mirror Tall ()) l1 l2 a => l1 a -> l2 a -> CombineTwo (Mirror Tall ()) l1 l2 a
(*/*) = combineTwo (Mirror $ Tall 1 0.1 (1/2))
-- | Combines two layouts horizzontally using Mirror Tall (a wide (**/*) = combineTwo (Mirror $ Tall 1 0.1 (2/3))
-- layout) giving more screen to the first layout (***/*) = combineTwo (Mirror $ Tall 1 0.1 (3/4))
(<-/>) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) (****/*) = combineTwo (Mirror $ Tall 1 0.1 (4/5))
=> l1 a -> l2 a -> CombineTwo (Mirror Tall ()) l1 l2 a (***/**) = combineTwo (Mirror $ Tall 1 0.1 (3/5))
(****/***) = combineTwo (Mirror $ Tall 1 0.1 (4/7))
-- | Combines two layouts horizzontally using Mirror Tall (a wide (***/****) = combineTwo (Mirror $ Tall 1 0.1 (3/7))
-- layout) giving more screen to the second layout (*/****) = combineTwo (Mirror $ Tall 1 0.1 (1/5))
(</->) :: (Read a, Eq a, LayoutClass l1 a, LayoutClass l2 a) (**/***) = combineTwo (Mirror $ Tall 1 0.1 (2/5))
=> l1 a -> l2 a -> CombineTwo (Mirror Tall ()) l1 l2 a (*/***) = combineTwo (Mirror $ Tall 1 0.1 (1/4))
(*/**) = combineTwo (Mirror $ Tall 1 0.1 (1/3))
-- implementation
(<||>) = combineTwo (dragPane Vertical 0.1 0.5)
(<-||>) = combineTwo (dragPane Vertical 0.1 0.2)
(<||->) = combineTwo (dragPane Vertical 0.1 0.8)
(<//>) = combineTwo (dragPane Horizontal 0.1 0.5)
(<-//>) = combineTwo (dragPane Horizontal 0.1 0.8)
(<//->) = combineTwo (dragPane Horizontal 0.1 0.2)
(<|>) = combineTwo (Tall 1 0.1 0.5)
(<-|>) = combineTwo (Tall 1 0.1 0.8)
(<|->) = combineTwo (Tall 1 0.1 0.1)
(</>) = combineTwo (Mirror $ Tall 1 0.1 0.5)
(<-/>) = combineTwo (Mirror $ Tall 1 0.1 0.8)
(</->) = combineTwo (Mirror $ Tall 1 0.1 0.2)
infixr 5 ||| infixr 5 |||
-- | A new layout combinator that allows the use of a prompt to change -- $nc
-- A new layout combinator that allows the use of a prompt to change
-- layout. For more information see "Xmonad.Prompt.Layout" -- layout. For more information see "Xmonad.Prompt.Layout"
(|||) :: (LayoutClass l1 a, LayoutClass l2 a) => l1 a -> l2 a -> NewSelect l1 l2 a (|||) :: (LayoutClass l1 a, LayoutClass l2 a) => l1 a -> l2 a -> NewSelect l1 l2 a
(|||) = NewSelect True (|||) = NewSelect True