XMonad.Actions.Plane

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

Copyright | (c) Marco Túlio Gontijo e Silva <marcot@riseup.net> Leonardo Serra <leoserra@minaslivre.org>
License | BSD3-style (see LICENSE)
Maintainer | Marco Túlio Gontijo e Silva <marcot@riseup.net>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Actions.Plane

Contents

- Usage
- Data types
- Key bindings
- Navigating through workspaces

Description

This module has functions to navigate through workspaces in a bidimensional manner. It allows the organization of workspaces in lines, and provides functions to move and shift windows in all four directions (left, up, right and down) possible in a surface.

This functionality was inspired by GNOME (finite) and KDE (infinite) keybindings for workspace navigation, and by XMonad.Actions.CycleWS for the idea of applying this approach to XMonad.

Synopsis

- data Direction
  - = ToLeft
  - | ToUp
  - | ToRight
  - | ToDown
- data Limits
  - = Finite
  - | Circular
  - | Linear
- data Lines
  - = GConf
  - | Lines Int
- planeKeys :: KeyMask -> Lines -> Limits -> Map (KeyMask, KeySym) (X ())
- planeShift :: Lines -> Limits -> Direction -> X ()
- planeMove :: Lines -> Limits -> Direction -> X ()

# Usage

You can use this module with the following in your `xmonad.hs` file:

    import XMonad.Actions.Plane
    import Data.Map (union)

    main = xmonad def {keys = myKeys}

    myKeys conf = union (keys def conf) $ myNewKeys conf

    myNewKeys (XConfig {modMask = modm}) = planeKeys modm (Lines 3) Finite

For detailed instructions on editing your key bindings, see the tutorial.

# Data types

data Direction #

Direction to go in the plane.

Constructors

ToLeft |
ToUp |
ToRight |
ToDown |

#### Instances

Instances details

Enum Direction # |
Instance details Defined in XMonad.Actions.Plane Methods succ :: Direction -> Direction # pred :: Direction -> Direction # toEnum :: Int -> Direction # fromEnum :: Direction -> Int # enumFrom :: Direction -> [Direction] # enumFromThen :: Direction -> Direction -> [Direction] # enumFromTo :: Direction -> Direction -> [Direction] # enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] #

data Limits #

Defines the behaviour when you're trying to move out of the limits.

Constructors

Finite | Ignore the function call, and keep in the same workspace.
Circular | Get on the other side, like in the Snake game.
Linear | The plan comes as a row, so it goes to the next or prev if the workspaces were numbered.

#### Instances

Instances details

Eq Limits # |
Instance details Defined in XMonad.Actions.Plane Methods (==) :: Limits -> Limits -> Bool # (/=) :: Limits -> Limits -> Bool #

data Lines #

The number of lines in which the workspaces will be arranged. It's possible to use a number of lines that is not a divisor of the number of workspaces, but the results are better when using a divisor. If it's not a divisor, the last line will have the remaining workspaces.

Constructors

GConf | Use `gconftool-2` to find out the number of lines.
Lines Int | Specify the number of lines explicitly.

# Key bindings

planeKeys :: KeyMask -> Lines -> Limits -> Map (KeyMask, KeySym) (X ()) #

This is the way most people would like to use this module. It attaches the `KeyMask` passed as a parameter with `xK_Left`, `xK_Up`, `xK_Right` and `xK_Down`, associating it with `planeMove` to the corresponding `Direction`. It also associates these bindings with `shiftMask` to `planeShift`.

# Navigating through workspaces

planeShift :: Lines -> Limits -> Direction -> X () #

Shift a window to the next workspace in `Direction`. Note that this will also move to the next workspace. It's a good idea to use the same `Lines` and `Limits` for all the bindings.

planeMove :: Lines -> Limits -> Direction -> X () #

Move to the next workspace in `Direction`.