Copyright | (c) 2019 Ningji Wei |
---|---|
License | BSD3-style (see LICENSE) |
Maintainer | Ningji Wei <tidues@gmail.com> |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
A layout combinator that support Shrink, Expand, and IncMasterN just as the
Tall
layout, and also support operations of two master windows:
a main master, which is the original master window;
a sub master, the first window of the second pane.
This combinator can be nested, and has a good support for using
XMonad.Layout.Tabbed as a sublayout.
Synopsis
- tmsCombineTwoDefault :: (LayoutClass l1 Window, LayoutClass l2 Window) => l1 Window -> l2 Window -> TMSCombineTwo l1 l2 Window
- tmsCombineTwo :: (LayoutClass l1 Window, LayoutClass l2 Window) => Bool -> Int -> Rational -> Rational -> l1 Window -> l2 Window -> TMSCombineTwo l1 l2 Window
- data TMSCombineTwo (l1 :: Type -> Type) (l2 :: Type -> Type) a = TMSCombineTwo {}
- newtype RowsOrColumns a = RowsOrColumns {}
- (|||) :: l a -> r a -> ChooseWrapper l r a
- data SwitchOrientation = SwitchOrientation
- data SwapSubMaster = SwapSubMaster
- data FocusSubMaster = FocusSubMaster
- data FocusedNextLayout = FocusedNextLayout
- data ChangeFocus
- data ChooseWrapper (l :: Type -> Type) (r :: Type -> Type) a = ChooseWrapper LR (l a) (r a) (Choose l r a)
- swapWindow :: Eq a => a -> Stack a -> Stack a
- focusWindow :: Eq a => a -> Stack a -> Stack a
- handleMessages :: LayoutClass l a => l a -> [SomeMessage] -> X (Maybe (l a))
Usage
You can use this module with the following in your xmonad.hs
:
import XMonad.Layout.TallMastersCombo
and make sure the Choose layout operator (|||) is hidden by adding the followings:
import XMonad hiding ((|||)) import XMonad.Layout hiding ((|||))
then, add something like
tmsCombineTwoDefault (Tall 0 (3/100) 0) simpleTabbed
This will make the Tall
layout as the master pane, and simpleTabbed
layout as the second pane.
You can shrink, expand, and increase more windows to the master pane just like using the
Tall
layout.
To swap and/or focus the sub master window (the first window in the second pane), you can add the following key bindings
, ((modm .|. shiftMask, m), sendMessage $ FocusSubMaster) , ((modm .|. shiftMask, xK_Return), sendMessage $ SwapSubMaster)
In each pane, you can use multiple layouts with the (|||)
combinator provided by this module,
and switch between them with the FocusedNextLayout
message. Below is one example
layout1 = Simplest ||| Tabbed layout2 = Full ||| Tabbed ||| (RowsOrColumns True) myLayout = tmsCombineTwoDefault layout1 layout2
then add the following key binding,
, ((modm, w), sendMessage $ FocusedNextLayout)
Now, pressing this key will toggle the multiple layouts in the currently focused pane.
You can mirror this layout with the default Mirror
key binding. But to have a more natural
behaviors, you can use the SwitchOrientation
message:
, ((modm, xK_space), sendMessage $ SwitchOrientation)
This will not mirror the tabbed decoration, and will keep sub-layouts that made by TallMastersCombo and RowsOrColumns display in natural orientations.
To merge layouts more flexibly, you can use tmsCombineTwo
instead.
tmsCombineTwo False 1 (3/100) (1/3) Simplest simpleTabbed
This creates a vertical merged layout with 1 window in the master pane, and the master pane shrinks and expands with a step of (3/100), and occupies (1/3) of the screen.
Each sub-layout have a focused window. To rotate between the focused windows across all the sub-layouts, using the following messages:
, ((modm .|. mod1, j), sendMessage $ NextFocus) , ((modm .|. mod1, k), sendMessage $ PrevFocus)
this let you jump to the focused window in the next/previous sub-layout.
Finally, this combinator can be nested. Here is one example,
subLayout = tmsCombineTwo False 1 (3/100) (1/2) Simplest simpleTabbed layout1 = simpleTabbed ||| subLayout layout2 = subLayout ||| simpleTabbed ||| (RowsOrColumns True) baseLayout = tmsCombineTwoDefault layout1 layout2 mylayouts = smartBorders $ avoidStruts $ mkToggle (FULL ?? EOT) $ baseLayout
this is a realization of the cool idea from
https://www.reddit.com/r/xmonad/comments/3vkrc3/does_this_layout_exist_if_not_can_anyone_suggest/
and is more flexible.
tmsCombineTwoDefault :: (LayoutClass l1 Window, LayoutClass l2 Window) => l1 Window -> l2 Window -> TMSCombineTwo l1 l2 Window Source #
Combine two layouts l1 l2 with default behaviors.
tmsCombineTwo :: (LayoutClass l1 Window, LayoutClass l2 Window) => Bool -> Int -> Rational -> Rational -> l1 Window -> l2 Window -> TMSCombineTwo l1 l2 Window Source #
A more flexible way of merging two layouts. User can specify if merge them vertical or horizontal, the number of windows in the first pane (master pane), the shink and expand increment, and the proportion occupied by the master pane.
data TMSCombineTwo (l1 :: Type -> Type) (l2 :: Type -> Type) a Source #
TMSCombineTwo | |
|
Instances
newtype RowsOrColumns a Source #
A simple layout that arranges windows in a row or a column with equal sizes.
It can switch between row mode and column mode by listening to the message SwitchOrientation
.
Instances
(|||) :: l a -> r a -> ChooseWrapper l r a Source #
This is same as the Choose combination operator.
Messages
data SwitchOrientation Source #
A message that switches the orientation of TallMasterCombo layout and the RowsOrColumns layout.
This is similar to the Mirror
message, but Mirror
cannot apply to hidden layouts, and when Mirror
applies to the Tabbed
decoration, it will also mirror the tabs, which may lead to unintended
visualizations. The SwitchOrientation
message refreshes layouts according to the orientation of the parent layout,
and will not affect the Tabbed
decoration.
Instances
Read SwitchOrientation Source # | |
Defined in XMonad.Layout.TallMastersCombo | |
Show SwitchOrientation Source # | |
Defined in XMonad.Layout.TallMastersCombo showsPrec :: Int -> SwitchOrientation -> ShowS # show :: SwitchOrientation -> String # showList :: [SwitchOrientation] -> ShowS # | |
Message SwitchOrientation Source # | |
Defined in XMonad.Layout.TallMastersCombo |
data SwapSubMaster Source #
This message swaps the current focused window with the sub master window (first window in the second pane).
Instances
Read SwapSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo readsPrec :: Int -> ReadS SwapSubMaster # readList :: ReadS [SwapSubMaster] # | |
Show SwapSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo showsPrec :: Int -> SwapSubMaster -> ShowS # show :: SwapSubMaster -> String # showList :: [SwapSubMaster] -> ShowS # | |
Message SwapSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo |
data FocusSubMaster Source #
This message changes the focus to the sub master window (first window in the second pane).
Instances
Read FocusSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo readsPrec :: Int -> ReadS FocusSubMaster # readList :: ReadS [FocusSubMaster] # | |
Show FocusSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo showsPrec :: Int -> FocusSubMaster -> ShowS # show :: FocusSubMaster -> String # showList :: [FocusSubMaster] -> ShowS # | |
Message FocusSubMaster Source # | |
Defined in XMonad.Layout.TallMastersCombo |
data FocusedNextLayout Source #
This message triggers the NextLayout
message in the pane that contains the focused window.
Instances
Read FocusedNextLayout Source # | |
Defined in XMonad.Layout.TallMastersCombo | |
Show FocusedNextLayout Source # | |
Defined in XMonad.Layout.TallMastersCombo showsPrec :: Int -> FocusedNextLayout -> ShowS # show :: FocusedNextLayout -> String # showList :: [FocusedNextLayout] -> ShowS # | |
Message FocusedNextLayout Source # | |
Defined in XMonad.Layout.TallMastersCombo |
data ChangeFocus Source #
This is a message for changing to the previous or next focused window across all the sub-layouts.
Instances
Read ChangeFocus Source # | |
Defined in XMonad.Layout.TallMastersCombo readsPrec :: Int -> ReadS ChangeFocus # readList :: ReadS [ChangeFocus] # readPrec :: ReadPrec ChangeFocus # readListPrec :: ReadPrec [ChangeFocus] # | |
Show ChangeFocus Source # | |
Defined in XMonad.Layout.TallMastersCombo showsPrec :: Int -> ChangeFocus -> ShowS # show :: ChangeFocus -> String # showList :: [ChangeFocus] -> ShowS # | |
Message ChangeFocus Source # | |
Defined in XMonad.Layout.TallMastersCombo |
Utilities
data ChooseWrapper (l :: Type -> Type) (r :: Type -> Type) a Source #
ChooseWrapper LR (l a) (r a) (Choose l r a) |
Instances
handleMessages :: LayoutClass l a => l a -> [SomeMessage] -> X (Maybe (l a)) Source #
Handle a list of messages one by one, then return the last refreshed layout.