xmonad-0.17.2: A tiling window manager

Copyright | (c) Spencer Janssen 2007
License | BSD3-style (see LICENSE)
Maintainer | dons@cse.unsw.edu.au
Stability | unstable
Portability | not portable, mtl, posix
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Operations

Contents

- Manage One Window
- Manage Windows
- Keyboard and Mouse
- Messages
- Save and Restore State
- Floating Layer
- Window Size Hints
- Rectangles
- Other Utilities

Description

Operations. A module for functions that don't cleanly fit anywhere else.

Synopsis

- manage :: Window -> X ()
- unmanage :: Window -> X ()
- killWindow :: Window -> X ()
- kill :: X ()
- isClient :: Window -> X Bool
- setInitialProperties :: Window -> X ()
- setWMState :: Window -> Int -> X ()
- setWindowBorderWithFallback :: Display -> Window -> String -> Pixel -> X ()
- hide :: Window -> X ()
- reveal :: Window -> X ()
- tileWindow :: Window -> Rectangle -> X ()
- setTopFocus :: X ()
- focus :: Window -> X ()
- isFixedSizeOrTransient :: Display -> Window -> X Bool
- windows :: (WindowSet -> WindowSet) -> X ()
- refresh :: X ()
- rescreen :: X ()
- modifyWindowSet :: (WindowSet -> WindowSet) -> X ()
- windowBracket :: (a -> Bool) -> X a -> X a
- windowBracket_ :: X Any -> X ()
- clearEvents :: EventMask -> X ()
- getCleanedScreenInfo :: MonadIO m => Display -> m [Rectangle]
- withFocused :: (Window -> X ()) -> X ()
- withUnfocused :: (Window -> X ()) -> X ()
- cleanMask :: KeyMask -> X KeyMask
- extraModifiers :: X [KeyMask]
- mouseDrag :: (Position -> Position -> X ()) -> X () -> X ()
- mouseMoveWindow :: Window -> X ()
- mouseResizeWindow :: Window -> X ()
- setButtonGrab :: Bool -> Window -> X ()
- setFocusX :: Window -> X ()
- cacheNumlockMask :: X ()
- mkGrabs :: [(KeyMask, KeySym)] -> X [(KeyMask, KeyCode)]
- sendMessage :: Message a => a -> X ()
- broadcastMessage :: Message a => a -> X ()
- sendMessageWithNoRefresh :: Message a => a -> WindowSpace -> X ()
- data StateFile = StateFile {
  - sfWins :: StackSet WorkspaceId String Window ScreenId ScreenDetail
  - sfExt :: [(String, String)]
  }
- writeStateToFile :: X ()
- readStateFile :: (LayoutClass l Window, Read (l Window)) => XConfig l -> X (Maybe XState)
- restart :: String -> Bool -> X ()
- float :: Window -> X ()
- floatLocation :: Window -> X (ScreenId, RationalRect)
- type D = (Dimension, Dimension)
- mkAdjust :: Window -> X (D -> D)
- applySizeHints :: Integral a => Dimension -> SizeHints -> (a, a) -> D
- applySizeHints' :: SizeHints -> D -> D
- applySizeHintsContents :: Integral a => SizeHints -> (a, a) -> D
- applyAspectHint :: (D, D) -> D -> D
- applyResizeIncHint :: D -> D -> D
- applyMaxSizeHint :: D -> D -> D
- containedIn :: Rectangle -> Rectangle -> Bool
- nubScreens :: [Rectangle] -> [Rectangle]
- pointWithin :: Position -> Position -> Rectangle -> Bool
- scaleRationalRect :: Rectangle -> RationalRect -> Rectangle
- initColor :: Display -> String -> IO (Maybe Pixel)
- pointScreen :: Position -> Position -> X (Maybe (Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail))
- screenWorkspace :: ScreenId -> X (Maybe WorkspaceId)
- setLayout :: Layout Window -> X ()
- updateLayout :: WorkspaceId -> Maybe (Layout Window) -> X ()

# Manage One Window

manage :: Window -> X () #

Add a new window to be managed in the current workspace. Bring it into focus.

Whether the window is already managed, or not, it is mapped, has its border set, and its event mask set.

unmanage :: Window -> X () #

A window no longer exists; remove it from the window list, on whatever workspace it is.

killWindow :: Window -> X () #

Kill the specified window. If we do kill it, we'll get a delete notify back from X.

There are two ways to delete a window. Either just kill it, or if it supports the delete protocol, send a delete event (e.g. firefox)

kill :: X () #

Kill the currently focused client.

isClient :: Window -> X Bool #

Is the window is under management by xmonad?

setInitialProperties :: Window -> X () #

Set some properties when we initially gain control of a window.

setWMState :: Window -> Int -> X () #

Set a window's WM_STATE property.

setWindowBorderWithFallback :: Display -> Window -> String -> Pixel -> X () #

Set the border color using the window's color map, if possible; otherwise fall back to the color in `Pixel`.

hide :: Window -> X () #

Hide a window by unmapping it and setting Iconified.

reveal :: Window -> X () #

Show a window by mapping it and setting Normal. This is harmless if the window was already visible.

tileWindow :: Window -> Rectangle -> X () #

Move and resize `w` such that it fits inside the given rectangle, including its border.

setTopFocus :: X () #

Set the focus to the window on top of the stack, or root

focus :: Window -> X () #

Set focus explicitly to window `w` if it is managed by us, or root. This happens if X notices we've moved the mouse (and perhaps moved the mouse to a new screen).

isFixedSizeOrTransient :: Display -> Window -> X Bool #

Detect whether a window has fixed size or is transient. This check can be used to determine whether the window should be floating or not

# Manage Windows

windows :: (WindowSet -> WindowSet) -> X () #

Modify the current window list with a pure function, and refresh

refresh :: X () #

Render the currently visible workspaces, as determined by the `StackSet`. Also, set focus to the focused window.

This is our `view` operation (MVC), in that it pretty prints our model with X calls.

rescreen :: X () #

The screen configuration may have changed (due to -- xrandr), update the state and refresh the screen, and reset the gap.

modifyWindowSet :: (WindowSet -> WindowSet) -> X () #

Modify the `WindowSet` in state with no special handling.

windowBracket :: (a -> Bool) -> X a -> X a #

Perform an `X` action and check its return value against a predicate p. If p holds, unwind changes to the `WindowSet` and replay them using `windows`.

windowBracket_ :: X Any -> X () #

Perform an `X` action. If it returns `Any True`, unwind the changes to the `WindowSet` and replay them using `windows`. This is a version of `windowBracket` that discards the return value and handles an `X` action that reports its need for refresh via `Any`.

clearEvents :: EventMask -> X () #

Remove all events of a given type from the event queue.

getCleanedScreenInfo :: MonadIO m => Display -> m [Rectangle] #

Clean the list of screens according to the rules documented for nubScreens.

withFocused :: (Window -> X ()) -> X () #

Apply an `X` operation to the currently focused window, if there is one.

withUnfocused :: (Window -> X ()) -> X () #

Apply an `X` operation to all unfocused windows on the current workspace, if there are any.

# Keyboard and Mouse

cleanMask :: KeyMask -> X KeyMask #

Strip numlock/capslock from a mask.

extraModifiers :: X [KeyMask] #

Combinations of extra modifier masks we need to grab keys/buttons for. (numlock and capslock)

mouseDrag :: (Position -> Position -> X ()) -> X () -> X () #

Accumulate mouse motion events

mouseMoveWindow :: Window -> X () #

Drag the window under the cursor with the mouse while it is dragged.

mouseResizeWindow :: Window -> X () #

Resize the window under the cursor with the mouse while it is dragged.

setButtonGrab :: Bool -> Window -> X () #

Tell whether or not to intercept clicks on a given window

setFocusX :: Window -> X () #

Call X to set the keyboard focus details.

cacheNumlockMask :: X () #

mkGrabs :: [(KeyMask, KeySym)] -> X [(KeyMask, KeyCode)] #

Given a list of keybindings, turn the given `KeySym`s into actual `KeyCode`s and prepare them for grabbing.

# Messages

sendMessage :: Message a => a -> X () #

Throw a message to the current `LayoutClass` possibly modifying how we layout the windows, in which case changes are handled through a refresh.

broadcastMessage :: Message a => a -> X () #

Send a message to all layouts, without refreshing.

sendMessageWithNoRefresh :: Message a => a -> WindowSpace -> X () #

Send a message to a layout, without refreshing.

# Save and Restore State

data StateFile #

A type to help serialize xmonad's state to a file.

Constructors

StateFile |

Fields

- sfWins :: StackSet WorkspaceId String Window ScreenId ScreenDetail
- sfExt :: [(String, String)]

#### Instances

Instances details

Read StateFile # |
Instance details Defined in XMonad.Operations Methods readsPrec :: Int -> ReadS StateFile readList :: ReadS [StateFile] readPrec :: ReadPrec StateFile readListPrec :: ReadPrec [StateFile]
Show StateFile # |
Instance details Defined in XMonad.Operations Methods showsPrec :: Int -> StateFile -> ShowS show :: StateFile -> String showList :: [StateFile] -> ShowS

writeStateToFile :: X () #

Write the current window state (and extensible state) to a file so that xmonad can resume with that state intact.

readStateFile :: (LayoutClass l Window, Read (l Window)) => XConfig l -> X (Maybe XState) #

Read the state of a previous xmonad instance from a file and return that state. The state file is removed after reading it.

restart :: String -> Bool -> X () #

`restart name resume` attempts to restart xmonad by executing the program `name`. If `resume` is `True`, restart with the current window state. When executing another window manager, `resume` should be `False`.

# Floating Layer

float :: Window -> X () #

Make a tiled window floating, using its suggested rectangle

floatLocation :: Window -> X (ScreenId, RationalRect) #

Given a window, find the screen it is located on, and compute the geometry of that window WRT that screen.

# Window Size Hints

type D = (Dimension, Dimension) #

An alias for a (width, height) pair

mkAdjust :: Window -> X (D -> D) #

Given a window, build an adjuster function that will reduce the given dimensions according to the window's border width and size hints.

applySizeHints :: Integral a => Dimension -> SizeHints -> (a, a) -> D #

Reduce the dimensions if needed to comply to the given SizeHints, taking window borders into account.

applySizeHints' :: SizeHints -> D -> D #

Use X11 size hints to scale a pair of dimensions.

applySizeHintsContents :: Integral a => SizeHints -> (a, a) -> D #

Reduce the dimensions if needed to comply to the given SizeHints.

applyAspectHint :: (D, D) -> D -> D #

Reduce the dimensions so their aspect ratio falls between the two given aspect ratios.

applyResizeIncHint :: D -> D -> D #

Reduce the dimensions so they are a multiple of the size increments.

applyMaxSizeHint :: D -> D -> D #

Reduce the dimensions if they exceed the given maximum dimensions.

# Rectangles

containedIn :: Rectangle -> Rectangle -> Bool #

Returns `True` if the first rectangle is contained within, but not equal to the second.

nubScreens :: [Rectangle] -> [Rectangle] #

Given a list of screens, remove all duplicated screens and screens that are entirely contained within another.

pointWithin :: Position -> Position -> Rectangle -> Bool #

`pointWithin x y r` returns `True` if the `(x, y)` co-ordinate is within `r`.

scaleRationalRect :: Rectangle -> RationalRect -> Rectangle #

Produce the actual rectangle from a screen and a ratio on that screen.

# Other Utilities

initColor :: Display -> String -> IO (Maybe Pixel) #

Get the `Pixel` value for a named color.

pointScreen :: Position -> Position -> X (Maybe (Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail)) #

Given a point, determine the screen (if any) that contains it.

screenWorkspace :: ScreenId -> X (Maybe WorkspaceId) #

Return workspace visible on screen `sc`, or `Nothing`.

setLayout :: Layout Window -> X () #

Set the layout of the currently viewed workspace.

updateLayout :: WorkspaceId -> Maybe (Layout Window) -> X () #

Update the layout field of a workspace.