XMonad.Layout.ZoomRow

xmonad-contrib-0.18.1: 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.ZoomRow

Contents

- Usage
- Creation
- Messages
- Use with non-`Eq` elements

Description

Row layout with individually resizable elements.

Synopsis

- data ZoomRow (f :: Type -> Type) a
- zoomRow :: (Eq a, Show a, Read a) => ZoomRow ClassEQ a
- data ZoomMessage
  - = Zoom Rational
  - | ZoomTo Rational
  - | ZoomFull Bool
  - | ZoomFullToggle
- zoomIn :: ZoomMessage
- zoomOut :: ZoomMessage
- zoomReset :: ZoomMessage
- zoomRowWith :: (EQF f a, Show (f a), Read (f a), Show a, Read a) => f a -> ZoomRow f a
- class EQF (f :: Type -> Type) a where
  - eq :: f a -> a -> a -> Bool
- data ClassEQ a = ClassEQ

# Usage

This module provides a layout which places all windows in a single row; the size occupied by each individual window can be increased and decreased, and a window can be set to use the whole available space whenever it has focus.

You can use this module by including the following in your `xmonad.hs`:

    import XMonad.Layout.ZoomRow

and using `zoomRow` somewhere in your `layoutHook`, for example:

    myLayout = zoomRow ||| Mirror zoomRow

To be able to resize windows, you can create keybindings to send the relevant `ZoomMessage`s:

      -- Increase the size occupied by the focused window
    , ((modMask .|. shifMask, xK_minus), sendMessage zoomIn)
      -- Decrease the size occupied by the focused window
    , ((modMayk             , xK_minus), sendMessage zoomOut)
      -- Reset the size occupied by the focused window
    , ((modMask             , xK_equal), sendMessage zoomReset)
      -- (Un)Maximize the focused window
    , ((modMask             , xK_f    ), sendMessage ToggleZoomFull)

For more information on editing your layoutHook and key bindings, see the tutorial and XMonad.Doc.Extending.

data ZoomRow (f :: Type -> Type) a #

A layout that arranges its windows in a horizontal row, and allows to change the relative size of each element independently.

#### Instances

Instances details

(EQF f a, Show a, Read a, Show (f a), Read (f a), Typeable f) => LayoutClass (ZoomRow f) a # |
Instance details Defined in XMonad.Layout.ZoomRow Methods runLayout :: Workspace WorkspaceId (ZoomRow f a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (ZoomRow f a)) # doLayout :: ZoomRow f a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (ZoomRow f a)) # pureLayout :: ZoomRow f a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: ZoomRow f a -> Rectangle -> X ([(a, Rectangle)], Maybe (ZoomRow f a)) # handleMessage :: ZoomRow f a -> SomeMessage -> X (Maybe (ZoomRow f a)) # pureMessage :: ZoomRow f a -> SomeMessage -> Maybe (ZoomRow f a) # description :: ZoomRow f a -> String #
(Read a, Read (f a)) => Read (ZoomRow f a) # |
Instance details Defined in XMonad.Layout.ZoomRow Methods readsPrec :: Int -> ReadS (ZoomRow f a) # readList :: ReadS [ZoomRow f a] # readPrec :: ReadPrec (ZoomRow f a) # readListPrec :: ReadPrec [ZoomRow f a] #
(Show a, Show (f a)) => Show (ZoomRow f a) # |
Instance details Defined in XMonad.Layout.ZoomRow Methods showsPrec :: Int -> ZoomRow f a -> ShowS # show :: ZoomRow f a -> String # showList :: [ZoomRow f a] -> ShowS #
(Eq a, Eq (f a)) => Eq (ZoomRow f a) # |
Instance details Defined in XMonad.Layout.ZoomRow Methods (==) :: ZoomRow f a -> ZoomRow f a -> Bool # (/=) :: ZoomRow f a -> ZoomRow f a -> Bool #

# Creation

zoomRow :: (Eq a, Show a, Read a) => ZoomRow ClassEQ a #

`ZoomRow` layout for laying out elements which are instances of `Eq`. Perfect for `Window`s.

# Messages

data ZoomMessage #

The type of messages accepted by a `ZoomRow` layout

Constructors

Zoom Rational | Multiply the focused window's size factor by the given number.
ZoomTo Rational | Set the focused window's size factor to the given number.
ZoomFull Bool | Set whether the focused window should occupy all available space when it has focus
ZoomFullToggle | Toggle whether the focused window should occupy all available space when it has focus

#### Instances

Instances details

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

zoomIn :: ZoomMessage #

Increase the size of the focused window. Defined as `Zoom 1.5`

zoomOut :: ZoomMessage #

Decrease the size of the focused window. Defined as `Zoom (2/3)`

zoomReset :: ZoomMessage #

Reset the size of the focused window. Defined as `ZoomTo 1`

# Use with non-`Eq` elements

Haskell's `Eq` class is usually concerned with structural equality, whereas what this layout really wants is for its elements to have a unique identity, even across changes. There are cases (such as, importantly, `Window`s) where the `Eq` instance for a type actually does that, but if you want to lay out something more exotic than windows and your `Eq` means something else, you can use the following.

zoomRowWith :: (EQF f a, Show (f a), Read (f a), Show a, Read a) => f a -> ZoomRow f a #

ZoomRow layout with a custom equality predicate. It should of course satisfy the laws for `Eq`, and you should also make sure that the layout never has to handle two "equal" elements at the same time (it won't do any huge damage, but might behave a bit strangely).

class EQF (f :: Type -> Type) a where #

Class for equivalence relations. Must be transitive, reflexive.

Methods

eq :: f a -> a -> a -> Bool #

#### Instances

Instances details

Eq a => EQF ClassEQ a # |
Instance details Defined in XMonad.Layout.ZoomRow Methods eq :: ClassEQ a -> a -> a -> Bool #
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 #

data ClassEQ a #

To use the usual `==`:

Constructors

ClassEQ |

#### Instances

Instances details

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