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

Copyright | (c) Nelson Elhage <nelhage@mit.edu>
License | BSD
Maintainer | Nelson Elhage <nelhage@mit.edu>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Actions.PhysicalScreens

Contents

- Usage

Description

Manipulate screens ordered by physical location instead of ID

Synopsis

- newtype PhysicalScreen = P Int
- getScreen :: ScreenComparator -> PhysicalScreen -> X (Maybe ScreenId)
- viewScreen :: ScreenComparator -> PhysicalScreen -> X ()
- sendToScreen :: ScreenComparator -> PhysicalScreen -> X ()
- onNextNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X ()
- onPrevNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X ()
- horizontalScreenOrderer :: ScreenComparator
- verticalScreenOrderer :: ScreenComparator
- newtype ScreenComparator = ScreenComparator ((ScreenId, Rectangle) -> (ScreenId, Rectangle) -> Ordering)
- getScreenIdAndRectangle :: Screen i l a ScreenId ScreenDetail -> (ScreenId, Rectangle)
- screenComparatorById :: (ScreenId -> ScreenId -> Ordering) -> ScreenComparator
- screenComparatorByRectangle :: (Rectangle -> Rectangle -> Ordering) -> ScreenComparator

# Usage

This module allows you name Xinerama screens from XMonad using their physical location relative to each other (as reported by Xinerama), rather than their `ScreenID` s, which are arbitrarily determined by your X server and graphics hardware.

You can specify how to order the screen by giving a ScreenComparator. To create a screen comparator you can use screenComparatorByRectangle or screenComparatorByScreenId. The default ScreenComparator orders screens by the upper-left-most corner, from top-to-bottom and then left-to-right.

Example usage in your `xmonad.hs` file:

    import XMonad.Actions.PhysicalScreens
    import Data.Default

    , ((modMask, xK_a), onPrevNeighbour def W.view)
    , ((modMask, xK_o), onNextNeighbour def W.view)
    , ((modMask .|. shiftMask, xK_a), onPrevNeighbour def W.shift)
    , ((modMask .|. shiftMask, xK_o), onNextNeighbour def W.shift)

    --
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    --
    [((modm .|. mask, key), f sc)
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, mask) <- [(viewScreen def, 0), (sendToScreen def, shiftMask)]]

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

newtype PhysicalScreen Source #

The type of the index of a screen by location

Constructors

P Int |

#### Instances

Instances details

Enum PhysicalScreen Source # |

Instance details

Defined in XMonad.Actions.PhysicalScreens

Methods

succ :: PhysicalScreen -> PhysicalScreen Source #

pred :: PhysicalScreen -> PhysicalScreen Source #

toEnum :: Int -> PhysicalScreen Source #

fromEnum :: PhysicalScreen -> Int Source #

enumFrom :: PhysicalScreen -> [PhysicalScreen] Source #

enumFromThen :: PhysicalScreen -> PhysicalScreen -> [PhysicalScreen] Source #

enumFromTo :: PhysicalScreen -> PhysicalScreen -> [PhysicalScreen] Source #

enumFromThenTo :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen -> [PhysicalScreen] Source #

Num PhysicalScreen Source # |

Instance details

Defined in XMonad.Actions.PhysicalScreens

Methods

(+) :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

(-) :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

(*) :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

negate :: PhysicalScreen -> PhysicalScreen Source #

abs :: PhysicalScreen -> PhysicalScreen Source #

signum :: PhysicalScreen -> PhysicalScreen Source #

fromInteger :: Integer -> PhysicalScreen Source #

Read PhysicalScreen Source # |
Instance details Defined in XMonad.Actions.PhysicalScreens Methods readsPrec :: Int -> ReadS PhysicalScreen Source # readList :: ReadS [PhysicalScreen] Source # readPrec :: ReadPrec PhysicalScreen Source # readListPrec :: ReadPrec [PhysicalScreen] Source #
Integral PhysicalScreen Source # |

Instance details

Defined in XMonad.Actions.PhysicalScreens

Methods

quot :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

rem :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

div :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

mod :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

quotRem :: PhysicalScreen -> PhysicalScreen -> (PhysicalScreen, PhysicalScreen) Source #

divMod :: PhysicalScreen -> PhysicalScreen -> (PhysicalScreen, PhysicalScreen) Source #

toInteger :: PhysicalScreen -> Integer Source #

Real PhysicalScreen Source # |
Instance details Defined in XMonad.Actions.PhysicalScreens Methods toRational :: PhysicalScreen -> Rational Source #
Show PhysicalScreen Source # |
Instance details Defined in XMonad.Actions.PhysicalScreens Methods showsPrec :: Int -> PhysicalScreen -> ShowS Source # show :: PhysicalScreen -> String Source # showList :: [PhysicalScreen] -> ShowS Source #
Eq PhysicalScreen Source # |
Instance details Defined in XMonad.Actions.PhysicalScreens Methods (==) :: PhysicalScreen -> PhysicalScreen -> Bool Source # (/=) :: PhysicalScreen -> PhysicalScreen -> Bool Source #
Ord PhysicalScreen Source # |

Instance details

Defined in XMonad.Actions.PhysicalScreens

Methods

compare :: PhysicalScreen -> PhysicalScreen -> Ordering Source #

(<) :: PhysicalScreen -> PhysicalScreen -> Bool Source #

(<=) :: PhysicalScreen -> PhysicalScreen -> Bool Source #

(>) :: PhysicalScreen -> PhysicalScreen -> Bool Source #

(>=) :: PhysicalScreen -> PhysicalScreen -> Bool Source #

max :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

min :: PhysicalScreen -> PhysicalScreen -> PhysicalScreen Source #

getScreen :: ScreenComparator -> PhysicalScreen -> X (Maybe ScreenId) Source #

Translate a physical screen index to a `ScreenId`

viewScreen :: ScreenComparator -> PhysicalScreen -> X () Source #

Switch to a given physical screen

sendToScreen :: ScreenComparator -> PhysicalScreen -> X () Source #

Send the active window to a given physical screen

onNextNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X () Source #

Apply operation on a WindowSet with the WorkspaceId of the next screen in the physical order as parameter.

onPrevNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X () Source #

Apply operation on a WindowSet with the WorkspaceId of the previous screen in the physical order as parameter.

horizontalScreenOrderer :: ScreenComparator Source #

orders screens by the upper-left-most corner, from left-to-right

verticalScreenOrderer :: ScreenComparator Source #

orders screens by the upper-left-most corner, from top-to-bottom

newtype ScreenComparator Source #

A ScreenComparator allow to compare two screen based on their coordonate and Xinerama Id

Constructors

ScreenComparator ((ScreenId, Rectangle) -> (ScreenId, Rectangle) -> Ordering) |

#### Instances

Instances details

Default ScreenComparator Source # | The default ScreenComparator orders screens by the upper-left-most corner, from top-to-bottom
Instance details Defined in XMonad.Actions.PhysicalScreens Methods def :: ScreenComparator #

getScreenIdAndRectangle :: Screen i l a ScreenId ScreenDetail -> (ScreenId, Rectangle) Source #

screenComparatorById :: (ScreenId -> ScreenId -> Ordering) -> ScreenComparator Source #

Compare screen only by their Xinerama id

screenComparatorByRectangle :: (Rectangle -> Rectangle -> Ordering) -> ScreenComparator Source #

Compare screen only by their coordonate