xmonad-contrib-0.18.0: Community-maintained extensions for xmonad

Copyright | Quentin Moser <moserq@gmail.com>
License | BSD-style (see LICENSE)
Maintainer | orphaned
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Layout.Groups

Contents

- Usage
- Messages
  - Useful `ModifySpec`s
- Types

Description

Two-level layout with windows split in individual layout groups, themselves managed by a user-provided layout.

Synopsis

- group :: l Window -> l2 (Group l Window) -> Groups l l2 Window
- data GroupsMessage
  - = ToEnclosing SomeMessage
  - | ToGroup Int SomeMessage
  - | ToFocused SomeMessage
  - | ToAll SomeMessage
  - | Refocus
  - | Modify ModifySpec
  - | ModifyX ModifySpecX
- type ModifySpec = forall (l :: Type -> Type). WithID l Window -> Zipper (Group l Window) -> Zipper (Group l Window)
- type ModifySpecX = forall (l :: Type -> Type). WithID l Window -> Zipper (Group l Window) -> X (Zipper (Group l Window))
- swapUp :: ModifySpec
- swapDown :: ModifySpec
- swapMaster :: ModifySpec
- focusUp :: ModifySpec
- focusDown :: ModifySpec
- focusMaster :: ModifySpec
- swapGroupUp :: ModifySpec
- swapGroupDown :: ModifySpec
- swapGroupMaster :: ModifySpec
- focusGroupUp :: ModifySpec
- focusGroupDown :: ModifySpec
- focusGroupMaster :: ModifySpec
- moveToGroupUp :: Bool -> ModifySpec
- moveToGroupDown :: Bool -> ModifySpec
- moveToNewGroupUp :: ModifySpec
- moveToNewGroupDown :: ModifySpec
- splitGroup :: ModifySpec
- data Groups (l :: Type -> Type) (l2 :: Type -> Type) a
- data Group (l :: Type -> Type) a = G {
  - gLayout :: WithID l a
  - gZipper :: Zipper a
  }
- onZipper :: forall a (l :: Type -> Type). (Zipper a -> Zipper a) -> Group l a -> Group l a
- onLayout :: forall (l :: Type -> Type) a. (WithID l a -> WithID l a) -> Group l a -> Group l a
- data WithID (l :: Type -> Type) a
- sameID :: forall (l :: Type -> Type) a. WithID l a -> WithID l a -> Bool

# Usage

This module provides a layout combinator that allows you to manage your windows in independent groups. You can provide both the layout with which to arrange the windows inside each group, and the layout with which the groups themselves will be arranged on the screen.

The XMonad.Layout.Groups.Examples and XMonad.Layout.Groups.Wmii modules contain examples of layouts that can be defined with this combinator. They're also the recommended starting point if you are a beginner and looking for something you can use easily.

One thing to note is that `Groups`-based layout have their own notion of the order of windows, which is completely separate from XMonad's. For this reason, operations like `SwapUp` will have no visible effect, and those like `focusUp` will focus the windows in an unpredictable order. For a better way of rearranging windows and moving focus in such a layout, see the example `ModifySpec`s (to be passed to the `Modify` message) provided by this module.

If you use both `Groups`-based and other layouts, The XMonad.Layout.Groups.Helpers module provides actions that can work correctly with both, defined using functions from XMonad.Actions.MessageFeedback.

group :: l Window -> l2 (Group l Window) -> Groups l l2 Window #

Create a `Groups` layout.

Note that the second parameter (the layout for arranging the groups) is not used on `Windows`, but on `Group`s. For this reason, you can only use layouts that don't specifically need to manage `Window`s. This is obvious, when you think about it.

# Messages

data GroupsMessage #

Messages accepted by `Groups`-based layouts. All other messages are forwarded to the layout of the currently focused subgroup (as if they had been wrapped in `ToFocused`).

Constructors

ToEnclosing SomeMessage | Send a message to the enclosing layout (the one that places the groups themselves)
ToGroup Int SomeMessage | Send a message to the layout for nth group (starting at 0)
ToFocused SomeMessage | Send a message to the layout for the focused group
ToAll SomeMessage | Send a message to all the sub-layouts
Refocus | Refocus the window which should be focused according to the layout.
Modify ModifySpec | Modify the ordering/grouping/focusing of windows according to a `ModifySpec`
ModifyX ModifySpecX | Same as `Modify`, but within the `X` monad

#### Instances

Instances details

Show GroupsMessage # |
Instance details Defined in XMonad.Layout.Groups Methods showsPrec :: Int -> GroupsMessage -> ShowS # show :: GroupsMessage -> String # showList :: [GroupsMessage] -> ShowS #
Message GroupsMessage # |
Instance details Defined in XMonad.Layout.Groups

type ModifySpec = forall (l :: Type -> Type). WithID l Window -> Zipper (Group l Window) -> Zipper (Group l Window) #

Type of functions describing modifications to a `Groups` layout. They are transformations on `Zipper`s of groups.

Things you shouldn't do:

- Forge new windows (they will be ignored)
- Duplicate windows (whatever happens is your problem)
- Remove windows (they will be added again)
- Duplicate layouts (only one will be kept, the rest will get the base layout)

Note that `ModifySpec` is a rank-2 type (indicating that `ModifySpec`s must be polymorphic in the layout type), so if you define functions taking `ModifySpec`s as arguments, or returning them, you'll need to write a type signature and add `{-# LANGUAGE Rank2Types #-}` at the beginning

type ModifySpecX = forall (l :: Type -> Type). WithID l Window -> Zipper (Group l Window) -> X (Zipper (Group l Window)) #

This is the same as `ModifySpec`, but it allows the function to use actions inside the `X` monad. This is useful, for example, if the function has to make decisions based on the results of a `runQuery`.

## Useful `ModifySpec`s

swapUp :: ModifySpec #

Swap the focused window with the previous one.

swapDown :: ModifySpec #

Swap the focused window with the next one.

swapMaster :: ModifySpec #

Swap the focused window with the (group's) master window.

focusUp :: ModifySpec #

Move focus to the previous window in the group.

focusDown :: ModifySpec #

Move focus to the next window in the group.

focusMaster :: ModifySpec #

Move focus to the group's master window.

swapGroupUp :: ModifySpec #

Swap the focused group with the previous one.

swapGroupDown :: ModifySpec #

Swap the focused group with the next one.

swapGroupMaster :: ModifySpec #

Swap the focused group with the master group.

focusGroupUp :: ModifySpec #

Move focus to the previous group.

focusGroupDown :: ModifySpec #

Move focus to the next group.

focusGroupMaster :: ModifySpec #

Move focus to the master group.

moveToGroupUp :: Bool -> ModifySpec #

Move the focused window to the previous group. If `True`, when in the first group, wrap around to the last one. If `False`, create a new group before it.

moveToGroupDown :: Bool -> ModifySpec #

Move the focused window to the next group. If `True`, when in the last group, wrap around to the first one. If `False`, create a new group after it.

moveToNewGroupUp :: ModifySpec #

Move the focused window to a new group before the current one.

moveToNewGroupDown :: ModifySpec #

Move the focused window to a new group after the current one.

splitGroup :: ModifySpec #

Split the focused group into two at the position of the focused window (below it, unless it's the last window - in that case, above it).

# Types

data Groups (l :: Type -> Type) (l2 :: Type -> Type) a #

The type of our layouts.

#### Instances

Instances details

(LayoutClass l Window, LayoutClass l2 (Group l Window)) => LayoutClass (Groups l l2) Window # |

Instance details

Defined in XMonad.Layout.Groups

Methods

runLayout :: Workspace WorkspaceId (Groups l l2 Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Groups l l2 Window)) #

doLayout :: Groups l l2 Window -> Rectangle -> Stack Window -> X ([(Window, Rectangle)], Maybe (Groups l l2 Window)) #

pureLayout :: Groups l l2 Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] #

emptyLayout :: Groups l l2 Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Groups l l2 Window)) #

handleMessage :: Groups l l2 Window -> SomeMessage -> X (Maybe (Groups l l2 Window)) #

pureMessage :: Groups l l2 Window -> SomeMessage -> Maybe (Groups l l2 Window) #

description :: Groups l l2 Window -> String #

(Read a, Read (l a), Read (l2 (Group l a))) => Read (Groups l l2 a) # |
Instance details Defined in XMonad.Layout.Groups Methods readsPrec :: Int -> ReadS (Groups l l2 a) # readList :: ReadS [Groups l l2 a] # readPrec :: ReadPrec (Groups l l2 a) # readListPrec :: ReadPrec [Groups l l2 a] #
(Show a, Show (l a), Show (l2 (Group l a))) => Show (Groups l l2 a) # |
Instance details Defined in XMonad.Layout.Groups Methods showsPrec :: Int -> Groups l l2 a -> ShowS # show :: Groups l l2 a -> String # showList :: [Groups l l2 a] -> ShowS #

data Group (l :: Type -> Type) a #

A group of windows and its layout algorithm.

Constructors

G |

Fields

- gLayout :: WithID l a
- gZipper :: Zipper a

#### Instances

Instances details

Eq a => EQF GroupEQ (Group l a) # |
Instance details Defined in XMonad.Layout.Groups.Examples Methods eq :: GroupEQ (Group l a) -> Group l a -> Group l a -> Bool #
(Read a, Read (l a)) => Read (Group l a) # |
Instance details Defined in XMonad.Layout.Groups Methods readsPrec :: Int -> ReadS (Group l a) # readList :: ReadS [Group l a] # readPrec :: ReadPrec (Group l a) # readListPrec :: ReadPrec [Group l a] #
(Show a, Show (l a)) => Show (Group l a) # |
Instance details Defined in XMonad.Layout.Groups Methods showsPrec :: Int -> Group l a -> ShowS # show :: Group l a -> String # showList :: [Group l a] -> ShowS #
Eq a => Eq (Group l a) # |
Instance details Defined in XMonad.Layout.Groups Methods (==) :: Group l a -> Group l a -> Bool # (/=) :: Group l a -> Group l a -> Bool #

onZipper :: forall a (l :: Type -> Type). (Zipper a -> Zipper a) -> Group l a -> Group l a #

onLayout :: forall (l :: Type -> Type) a. (WithID l a -> WithID l a) -> Group l a -> Group l a #

data WithID (l :: Type -> Type) a #

Split an infinite list into two. I ended up not needing this, but let's keep it just in case. split :: [a] -> ([a], [a]) split as = snd $ foldr step (True, ([], [])) as where step a (True, (as1, as2)) = (False, (a:as1, as2)) step a (False, (as1, as2)) = (True, (as1, a:as2))

Add a unique identity to a layout so we can follow it around.

#### Instances

Instances details

LayoutClass l a => LayoutClass (WithID l) a # |

Instance details

Defined in XMonad.Layout.Groups

Methods

runLayout :: Workspace WorkspaceId (WithID l a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (WithID l a)) #

doLayout :: WithID l a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (WithID l a)) #

pureLayout :: WithID l a -> Rectangle -> Stack a -> [(a, Rectangle)] #

emptyLayout :: WithID l a -> Rectangle -> X ([(a, Rectangle)], Maybe (WithID l a)) #

handleMessage :: WithID l a -> SomeMessage -> X (Maybe (WithID l a)) #

pureMessage :: WithID l a -> SomeMessage -> Maybe (WithID l a) #

description :: WithID l a -> String #

Read (l a) => Read (WithID l a) # |
Instance details Defined in XMonad.Layout.Groups Methods readsPrec :: Int -> ReadS (WithID l a) # readList :: ReadS [WithID l a] # readPrec :: ReadPrec (WithID l a) # readListPrec :: ReadPrec [WithID l a] #
Show (l a) => Show (WithID l a) # |
Instance details Defined in XMonad.Layout.Groups Methods showsPrec :: Int -> WithID l a -> ShowS # show :: WithID l a -> String # showList :: [WithID l a] -> ShowS #
Eq (WithID l a) # |
Instance details Defined in XMonad.Layout.Groups Methods (==) :: WithID l a -> WithID l a -> Bool # (/=) :: WithID l a -> WithID l a -> Bool #

sameID :: forall (l :: Type -> Type) a. WithID l a -> WithID l a -> Bool #

Compare the ids of two `WithID` values