xmonad-0.18.0: A tiling window manager

Copyright | (c) Spencer Janssen 2007
License | BSD3-style (see LICENSE)
Maintainer | spencerjanssen@gmail.com
Stability | unstable
Portability | not portable, uses cunning newtype deriving
Safe Haskell | None
Language | Haskell2010

XMonad.Core

Description

The `X` monad, a state monad transformer over `IO`, for the window manager state, and support routines.

Synopsis

- data X a
- type WindowSet = StackSet WorkspaceId (Layout Window) Window ScreenId ScreenDetail
- type WindowSpace = Workspace WorkspaceId (Layout Window) Window
- type WorkspaceId = String
- newtype ScreenId = S Int
- newtype ScreenDetail = SD {
  - screenRect :: Rectangle
  }
- data XState = XState {
  - windowset :: !WindowSet
  - mapped :: !(Set Window)
  - waitingUnmap :: !(Map Window Int)
  - dragging :: !(Maybe (Position -> Position -> X (), X ()))
  - numberlockMask :: !KeyMask
  - extensibleState :: !(Map String (Either String StateExtension))
  }
- data XConf = XConf {
  - display :: Display
  - config :: !(XConfig Layout)
  - theRoot :: !Window
  - normalBorder :: !Pixel
  - focusedBorder :: !Pixel
  - keyActions :: !(Map (KeyMask, KeySym) (X ()))
  - buttonActions :: !(Map (KeyMask, Button) (Window -> X ()))
  - mouseFocused :: !Bool
  - mousePosition :: !(Maybe (Position, Position))
  - currentEvent :: !(Maybe Event)
  - directories :: !Directories
  }
- data XConfig (l :: Type -> Type) = XConfig {
  - normalBorderColor :: !String
  - focusedBorderColor :: !String
  - terminal :: !String
  - layoutHook :: !(l Window)
  - manageHook :: !ManageHook
  - handleEventHook :: !(Event -> X All)
  - workspaces :: ![String]
  - modMask :: !KeyMask
  - keys :: !(XConfig Layout -> Map (ButtonMask, KeySym) (X ()))
  - mouseBindings :: !(XConfig Layout -> Map (ButtonMask, Button) (Window -> X ()))
  - borderWidth :: !Dimension
  - logHook :: !(X ())
  - startupHook :: !(X ())
  - focusFollowsMouse :: !Bool
  - clickJustFocuses :: !Bool
  - clientMask :: !EventMask
  - rootMask :: !EventMask
  - handleExtraArgs :: !([String] -> XConfig Layout -> IO (XConfig Layout))
  - extensibleConf :: !(Map TypeRep ConfExtension)
  }
- class (Show (layout a), Typeable layout) => LayoutClass (layout :: Type -> Type) a where
  - runLayout :: Workspace WorkspaceId (layout a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
  - doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
  - pureLayout :: layout a -> Rectangle -> Stack a -> [(a, Rectangle)]
  - emptyLayout :: layout a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
  - handleMessage :: layout a -> SomeMessage -> X (Maybe (layout a))
  - pureMessage :: layout a -> SomeMessage -> Maybe (layout a)
  - description :: layout a -> String
- data Layout a = (LayoutClass l a, Read (l a)) => Layout (l a)
- readsLayout :: Layout a -> String -> [(Layout a, String)]
- class Typeable (a :: k)
- class Typeable a => Message a
- data SomeMessage = Message a => SomeMessage a
- fromMessage :: Message m => SomeMessage -> Maybe m
- data LayoutMessages
  - = Hide
  - | ReleaseResources
- data StateExtension
  - = ExtensionClass a => StateExtension a
  - | (Read a, Show a, ExtensionClass a) => PersistentExtension a
- class Typeable a => ExtensionClass a where
  - initialValue :: a
  - extensionType :: a -> StateExtension
- data ConfExtension = Typeable a => ConfExtension a
- runX :: XConf -> XState -> X a -> IO (a, XState)
- catchX :: X a -> X a -> X a
- userCode :: X a -> X (Maybe a)
- userCodeDef :: a -> X a -> X a
- io :: MonadIO m => IO a -> m a
- catchIO :: MonadIO m => IO () -> m ()
- installSignalHandlers :: MonadIO m => m ()
- uninstallSignalHandlers :: MonadIO m => m ()
- withDisplay :: (Display -> X a) -> X a
- withWindowSet :: (WindowSet -> X a) -> X a
- isRoot :: Window -> X Bool
- runOnWorkspaces :: (WindowSpace -> X WindowSpace) -> X ()
- getAtom :: String -> X Atom
- spawn :: MonadIO m => String -> m ()
- spawnPID :: MonadIO m => String -> m ProcessID
- xfork :: MonadIO m => IO () -> m ProcessID
- xmessage :: MonadIO m => String -> m ()
- recompile :: MonadIO m => Directories -> Bool -> m Bool
- trace :: MonadIO m => String -> m ()
- whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- whenX :: X Bool -> X () -> X ()
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- getXMonadDir :: X String
- getXMonadCacheDir :: X String
- getXMonadDataDir :: X String
- stateFileName :: Directories -> FilePath
- binFileName :: Directories -> FilePath
- atom_WM_STATE :: X Atom
- atom_WM_PROTOCOLS :: X Atom
- atom_WM_DELETE_WINDOW :: X Atom
- atom_WM_TAKE_FOCUS :: X Atom
- withWindowAttributes :: Display -> Window -> (WindowAttributes -> X ()) -> X ()
- type ManageHook = Query (Endo WindowSet)
- newtype Query a = Query (ReaderT Window X a)
- runQuery :: Query a -> Window -> X a
- data Directories' a = Directories {
  - dataDir :: !a
  - cfgDir :: !a
  - cacheDir :: !a
  }
- type Directories = Directories' FilePath
- getDirectories :: IO Directories

# Documentation

data X a #

The X monad, `ReaderT` and `StateT` transformers over `IO` encapsulating the window manager configuration and state, respectively.

Dynamic components may be retrieved with `get`, static components with `ask`. With newtype deriving we get readers and state monads instantiated on `XConf` and `XState` automatically.

#### Instances

Instances details

MonadIO X # |
Instance details Defined in XMonad.Core Methods liftIO :: IO a -> X a #
Applicative X # |
Instance details Defined in XMonad.Core Methods pure :: a -> X a # (<*>) :: X (a -> b) -> X a -> X b # liftA2 :: (a -> b -> c) -> X a -> X b -> X c # (*>) :: X a -> X b -> X b # (<*) :: X a -> X b -> X a #
Functor X # |
Instance details Defined in XMonad.Core Methods fmap :: (a -> b) -> X a -> X b # (<$) :: a -> X b -> X a #
Monad X # |
Instance details Defined in XMonad.Core Methods (>>=) :: X a -> (a -> X b) -> X b # (>>) :: X a -> X b -> X b # return :: a -> X a #
MonadFail X # |
Instance details Defined in XMonad.Core Methods fail :: String -> X a #
MonadReader XConf X # |
Instance details Defined in XMonad.Core Methods ask :: X XConf # local :: (XConf -> XConf) -> X a -> X a # reader :: (XConf -> a) -> X a #
MonadState XState X # |
Instance details Defined in XMonad.Core Methods get :: X XState # put :: XState -> X () # state :: (XState -> (a, XState)) -> X a #
Default a => Default (X a) # |
Instance details Defined in XMonad.Core Methods def :: X a #
Monoid a => Monoid (X a) # |
Instance details Defined in XMonad.Core Methods mempty :: X a # mappend :: X a -> X a -> X a # mconcat :: [X a] -> X a #
Semigroup a => Semigroup (X a) # |
Instance details Defined in XMonad.Core Methods (<>) :: X a -> X a -> X a # sconcat :: NonEmpty (X a) -> X a # stimes :: Integral b => b -> X a -> X a #

type WindowSet = StackSet WorkspaceId (Layout Window) Window ScreenId ScreenDetail #

type WindowSpace = Workspace WorkspaceId (Layout Window) Window #

type WorkspaceId = String #

Virtual workspace indices

newtype ScreenId #

Physical screen indices

Constructors

S Int |

#### Instances

Instances details

Enum ScreenId # |
Instance details Defined in XMonad.Core Methods succ :: ScreenId -> ScreenId # pred :: ScreenId -> ScreenId # toEnum :: Int -> ScreenId # fromEnum :: ScreenId -> Int # enumFrom :: ScreenId -> [ScreenId] # enumFromThen :: ScreenId -> ScreenId -> [ScreenId] # enumFromTo :: ScreenId -> ScreenId -> [ScreenId] # enumFromThenTo :: ScreenId -> ScreenId -> ScreenId -> [ScreenId] #
Num ScreenId # |
Instance details Defined in XMonad.Core Methods (+) :: ScreenId -> ScreenId -> ScreenId # (-) :: ScreenId -> ScreenId -> ScreenId # (*) :: ScreenId -> ScreenId -> ScreenId # negate :: ScreenId -> ScreenId # abs :: ScreenId -> ScreenId # signum :: ScreenId -> ScreenId # fromInteger :: Integer -> ScreenId #
Read ScreenId # |
Instance details Defined in XMonad.Core Methods readsPrec :: Int -> ReadS ScreenId # readList :: ReadS [ScreenId] # readPrec :: ReadPrec ScreenId # readListPrec :: ReadPrec [ScreenId] #
Integral ScreenId # |
Instance details Defined in XMonad.Core Methods quot :: ScreenId -> ScreenId -> ScreenId # rem :: ScreenId -> ScreenId -> ScreenId # div :: ScreenId -> ScreenId -> ScreenId # mod :: ScreenId -> ScreenId -> ScreenId # quotRem :: ScreenId -> ScreenId -> (ScreenId, ScreenId) # divMod :: ScreenId -> ScreenId -> (ScreenId, ScreenId) # toInteger :: ScreenId -> Integer #
Real ScreenId # |
Instance details Defined in XMonad.Core Methods toRational :: ScreenId -> Rational #
Show ScreenId # |
Instance details Defined in XMonad.Core Methods showsPrec :: Int -> ScreenId -> ShowS # show :: ScreenId -> String # showList :: [ScreenId] -> ShowS #
Eq ScreenId # |
Instance details Defined in XMonad.Core Methods (==) :: ScreenId -> ScreenId -> Bool # (/=) :: ScreenId -> ScreenId -> Bool #
Ord ScreenId # |
Instance details Defined in XMonad.Core Methods compare :: ScreenId -> ScreenId -> Ordering # (<) :: ScreenId -> ScreenId -> Bool # (<=) :: ScreenId -> ScreenId -> Bool # (>) :: ScreenId -> ScreenId -> Bool # (>=) :: ScreenId -> ScreenId -> Bool # max :: ScreenId -> ScreenId -> ScreenId # min :: ScreenId -> ScreenId -> ScreenId #

newtype ScreenDetail #

The `Rectangle` with screen dimensions

Constructors

SD |
Fields screenRect :: Rectangle

#### Instances

Instances details

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

data XState #

XState, the (mutable) window manager state.

Constructors

XState |
Fields windowset :: !WindowSet workspace list mapped :: !(Set Window) the Set of mapped windows waitingUnmap :: !(Map Window Int) the number of expected UnmapEvents dragging :: !(Maybe (Position -> Position -> X (), X ())) numberlockMask :: !KeyMask The numlock modifier extensibleState :: !(Map String (Either String StateExtension)) stores custom state information. The module XMonad.Util.ExtensibleState in xmonad-contrib provides additional information and a simple interface for using this.

#### Instances

Instances details

MonadState XState X # |
Instance details Defined in XMonad.Core Methods get :: X XState # put :: XState -> X () # state :: (XState -> (a, XState)) -> X a #

data XConf #

XConf, the (read-only) window manager configuration.

Constructors

XConf |
Fields display :: Display the X11 display config :: !(XConfig Layout) initial user configuration theRoot :: !Window the root window normalBorder :: !Pixel border color of unfocused windows focusedBorder :: !Pixel border color of the focused window keyActions :: !(Map (KeyMask, KeySym) (X ())) a mapping of key presses to actions buttonActions :: !(Map (KeyMask, Button) (Window -> X ())) a mapping of button presses to actions mouseFocused :: !Bool was refocus caused by mouse action? mousePosition :: !(Maybe (Position, Position)) position of the mouse according to the event currently being processed currentEvent :: !(Maybe Event) event currently being processed directories :: !Directories directories to use

#### Instances

Instances details

MonadReader XConf X # |
Instance details Defined in XMonad.Core Methods ask :: X XConf # local :: (XConf -> XConf) -> X a -> X a # reader :: (XConf -> a) -> X a #

data XConfig (l :: Type -> Type) #

Constructors

XConfig |
Fields normalBorderColor :: !String Non focused windows border color. Default: "#dddddd" focusedBorderColor :: !String Focused windows border color. Default: "#ff0000" terminal :: !String The preferred terminal application. Default: "xterm" layoutHook :: !(l Window) The available layouts manageHook :: !ManageHook The action to run when a new window is opened handleEventHook :: !(Event -> X All) Handle an X event, returns (All True) if the default handler should also be run afterwards. mappend should be used for combining event hooks in most cases. workspaces :: ![String] The list of workspaces' names modMask :: !KeyMask the mod modifier keys :: !(XConfig Layout -> Map (ButtonMask, KeySym) (X ())) The key binding: a map from key presses and actions mouseBindings :: !(XConfig Layout -> Map (ButtonMask, Button) (Window -> X ())) The mouse bindings borderWidth :: !Dimension The border width logHook :: !(X ()) The action to perform when the windows set is changed startupHook :: !(X ()) The action to perform on startup focusFollowsMouse :: !Bool Whether window entry events can change focus clickJustFocuses :: !Bool False to make a click which changes focus to be additionally passed to the window clientMask :: !EventMask The client events that xmonad is interested in rootMask :: !EventMask The root events that xmonad is interested in handleExtraArgs :: !([String] -> XConfig Layout -> IO (XConfig Layout)) Modify the configuration, complain about extra arguments etc. with arguments that are not handled by default extensibleConf :: !(Map TypeRep ConfExtension) Stores custom config information. The module XMonad.Util.ExtensibleConf in xmonad-contrib provides additional information and a simple interface for using this.

#### Instances

Instances details

a ~ Choose Tall (Choose (Mirror Tall) Full) => Default (XConfig a) # |
Instance details Defined in XMonad.Config Methods def :: XConfig a #

class (Show (layout a), Typeable layout) => LayoutClass (layout :: Type -> Type) a where #

Every layout must be an instance of `LayoutClass`, which defines the basic layout operations along with a sensible default for each.

All of the methods have default implementations, so there is no minimal complete definition. They do, however, have a dependency structure by default; this is something to be aware of should you choose to implement one of these methods. Here is how a minimal complete definition would look like if we did not provide any default implementations:

- `runLayout` || ((`doLayout` || `pureLayout`) && `emptyLayout`)
- `handleMessage` || `pureMessage`
- `description`

Note that any code which uses `LayoutClass` methods should only ever call `runLayout`, `handleMessage`, and `description`! In other words, the only calls to `doLayout`, `pureMessage`, and other such methods should be from the default implementations of `runLayout`, `handleMessage`, and so on. This ensures that the proper methods will be used, regardless of the particular methods that any `LayoutClass` instance chooses to define.

Minimal complete definition

Nothing

Methods

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

By default, `runLayout` calls `doLayout` if there are any windows to be laid out, and `emptyLayout` otherwise. Most instances of `LayoutClass` probably do not need to implement `runLayout`; it is only useful for layouts which wish to make use of more of the `Workspace` information (for example, XMonad.Layout.PerWorkspace).

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

Given a `Rectangle` in which to place the windows, and a `Stack` of windows, return a list of windows and their corresponding Rectangles. If an element is not given a Rectangle by `doLayout`, then it is not shown on screen. The order of windows in this list should be the desired stacking order.

Also possibly return a modified layout (by returning `Just newLayout`), if this layout needs to be modified (e.g. if it keeps track of some sort of state). Return `Nothing` if the layout does not need to be modified.

Layouts which do not need access to the `X` monad (`IO`, window manager state, or configuration) and do not keep track of their own state should implement `pureLayout` instead of `doLayout`.

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

This is a pure version of `doLayout`, for cases where we don't need access to the `X` monad to determine how to lay out the windows, and we don't need to modify the layout itself.

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

`emptyLayout` is called when there are no windows.

handleMessage :: layout a -> SomeMessage -> X (Maybe (layout a)) #

`handleMessage` performs message handling. If `handleMessage` returns `Nothing`, then the layout did not respond to the message and the screen is not refreshed. Otherwise, `handleMessage` returns an updated layout and the screen is refreshed.

Layouts which do not need access to the `X` monad to decide how to handle messages should implement `pureMessage` instead of `handleMessage` (this restricts the risk of error, and makes testing much easier).

pureMessage :: layout a -> SomeMessage -> Maybe (layout a) #

Respond to a message by (possibly) changing our layout, but taking no other action. If the layout changes, the screen will be refreshed.

description :: layout a -> String #

This should be a human-readable string that is used when selecting layouts by name. The default implementation is `show`, which is in some cases a poor default.

#### Instances

Instances details

LayoutClass Layout Window # |
Instance details Defined in XMonad.Core Methods runLayout :: Workspace WorkspaceId (Layout Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Layout Window)) # doLayout :: Layout Window -> Rectangle -> Stack Window -> X ([(Window, Rectangle)], Maybe (Layout Window)) # pureLayout :: Layout Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] # emptyLayout :: Layout Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Layout Window)) # handleMessage :: Layout Window -> SomeMessage -> X (Maybe (Layout Window)) # pureMessage :: Layout Window -> SomeMessage -> Maybe (Layout Window) # description :: Layout Window -> String #
LayoutClass Full a # |
Instance details Defined in XMonad.Layout Methods runLayout :: Workspace WorkspaceId (Full a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (Full a)) # doLayout :: Full a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Full a)) # pureLayout :: Full a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: Full a -> Rectangle -> X ([(a, Rectangle)], Maybe (Full a)) # handleMessage :: Full a -> SomeMessage -> X (Maybe (Full a)) # pureMessage :: Full a -> SomeMessage -> Maybe (Full a) # description :: Full a -> String #
LayoutClass Tall a # |
Instance details Defined in XMonad.Layout Methods runLayout :: Workspace WorkspaceId (Tall a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (Tall a)) # doLayout :: Tall a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Tall a)) # pureLayout :: Tall a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: Tall a -> Rectangle -> X ([(a, Rectangle)], Maybe (Tall a)) # handleMessage :: Tall a -> SomeMessage -> X (Maybe (Tall a)) # pureMessage :: Tall a -> SomeMessage -> Maybe (Tall a) # description :: Tall a -> String #
LayoutClass l a => LayoutClass (Mirror l) a # |
Instance details Defined in XMonad.Layout Methods runLayout :: Workspace WorkspaceId (Mirror l a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (Mirror l a)) # doLayout :: Mirror l a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Mirror l a)) # pureLayout :: Mirror l a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: Mirror l a -> Rectangle -> X ([(a, Rectangle)], Maybe (Mirror l a)) # handleMessage :: Mirror l a -> SomeMessage -> X (Maybe (Mirror l a)) # pureMessage :: Mirror l a -> SomeMessage -> Maybe (Mirror l a) # description :: Mirror l a -> String #
(LayoutClass l a, LayoutClass r a) => LayoutClass (Choose l r) a # |
Instance details Defined in XMonad.Layout Methods runLayout :: Workspace WorkspaceId (Choose l r a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (Choose l r a)) # doLayout :: Choose l r a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Choose l r a)) # pureLayout :: Choose l r a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: Choose l r a -> Rectangle -> X ([(a, Rectangle)], Maybe (Choose l r a)) # handleMessage :: Choose l r a -> SomeMessage -> X (Maybe (Choose l r a)) # pureMessage :: Choose l r a -> SomeMessage -> Maybe (Choose l r a) # description :: Choose l r a -> String #

data Layout a #

An existential type that can hold any object that is in `Read` and `LayoutClass`.

Constructors

(LayoutClass l a, Read (l a)) => Layout (l a) |

#### Instances

Instances details

LayoutClass Layout Window # |
Instance details Defined in XMonad.Core Methods runLayout :: Workspace WorkspaceId (Layout Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Layout Window)) # doLayout :: Layout Window -> Rectangle -> Stack Window -> X ([(Window, Rectangle)], Maybe (Layout Window)) # pureLayout :: Layout Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] # emptyLayout :: Layout Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (Layout Window)) # handleMessage :: Layout Window -> SomeMessage -> X (Maybe (Layout Window)) # pureMessage :: Layout Window -> SomeMessage -> Maybe (Layout Window) # description :: Layout Window -> String #
Show (Layout a) # |
Instance details Defined in XMonad.Core Methods showsPrec :: Int -> Layout a -> ShowS # show :: Layout a -> String # showList :: [Layout a] -> ShowS #

readsLayout :: Layout a -> String -> [(Layout a, String)] #

Using the `Layout` as a witness, parse existentially wrapped windows from a `String`.

class Typeable (a :: k) #

The class `Typeable` allows a concrete representation of a type to be calculated.

Minimal complete definition

typeRep#

class Typeable a => Message a #

Based on ideas in /An Extensible Dynamically-Typed Hierarchy of Exceptions/, Simon Marlow, 2006. Use extensible messages to the `handleMessage` handler.

User-extensible messages must be a member of this class.

#### Instances

Instances details

Message Event # |
Instance details Defined in XMonad.Core
Message LayoutMessages # |
Instance details Defined in XMonad.Core
Message ChangeLayout # |
Instance details Defined in XMonad.Layout
Message IncMasterN # |
Instance details Defined in XMonad.Layout
Message JumpToLayout # |
Instance details Defined in XMonad.Layout
Message Resize # |
Instance details Defined in XMonad.Layout

data SomeMessage #

A wrapped value of some type in the `Message` class.

Constructors

Message a => SomeMessage a |

fromMessage :: Message m => SomeMessage -> Maybe m #

And now, unwrap a given, unknown `Message` type, performing a (dynamic) type check on the result.

data LayoutMessages #

`LayoutMessages` are core messages that all layouts (especially stateful layouts) should consider handling.

Constructors

Hide | sent when a layout becomes non-visible
ReleaseResources | sent when xmonad is exiting or restarting

#### Instances

Instances details

Eq LayoutMessages # |
Instance details Defined in XMonad.Core Methods (==) :: LayoutMessages -> LayoutMessages -> Bool # (/=) :: LayoutMessages -> LayoutMessages -> Bool #
Message LayoutMessages # |
Instance details Defined in XMonad.Core

data StateExtension #

Existential type to store a state extension.

Constructors

ExtensionClass a => StateExtension a | Non-persistent state extension
(Read a, Show a, ExtensionClass a) => PersistentExtension a | Persistent extension

class Typeable a => ExtensionClass a where #

Every module must make the data it wants to store an instance of this class.

Minimal complete definition: initialValue

Minimal complete definition

initialValue

Methods

initialValue :: a #

Defines an initial value for the state extension

extensionType :: a -> StateExtension #

Specifies whether the state extension should be persistent. Setting this method to `PersistentExtension` will make the stored data survive restarts, but requires a to be an instance of Read and Show.

It defaults to `StateExtension`, i.e. no persistence.

data ConfExtension #

Existential type to store a config extension.

Constructors

Typeable a => ConfExtension a |

runX :: XConf -> XState -> X a -> IO (a, XState) #

Run the `X` monad, given a chunk of `X` monad code, and an initial state Return the result, and final state

catchX :: X a -> X a -> X a #

Run in the `X` monad, and in case of exception, and catch it and log it to stderr, and run the error case.

userCode :: X a -> X (Maybe a) #

Execute the argument, catching all exceptions. Either this function or `catchX` should be used at all callsites of user customized code.

userCodeDef :: a -> X a -> X a #

Same as userCode but with a default argument to return instead of using Maybe, provided for convenience.

io :: MonadIO m => IO a -> m a #

Lift an `IO` action into the `X` monad

catchIO :: MonadIO m => IO () -> m () #

Lift an `IO` action into the `X` monad. If the action results in an `IO` exception, log the exception to stderr and continue normal execution.

installSignalHandlers :: MonadIO m => m () #

Ignore SIGPIPE to avoid termination when a pipe is full, and SIGCHLD to avoid zombie processes, and clean up any extant zombie processes.

uninstallSignalHandlers :: MonadIO m => m () #

withDisplay :: (Display -> X a) -> X a #

Run a monad action with the current display settings

withWindowSet :: (WindowSet -> X a) -> X a #

Run a monadic action with the current stack set

isRoot :: Window -> X Bool #

True if the given window is the root window

runOnWorkspaces :: (WindowSpace -> X WindowSpace) -> X () #

This is basically a map function, running a function in the `X` monad on each workspace with the output of that function being the modified workspace.

getAtom :: String -> X Atom #

Wrapper for the common case of atom internment

spawn :: MonadIO m => String -> m () #

spawn. Launch an external application. Specifically, it double-forks and runs the `String` you pass as a command to /bin/sh.

Note this function assumes your locale uses utf8.

spawnPID :: MonadIO m => String -> m ProcessID #

Like `spawn`, but returns the `ProcessID` of the launched application

xfork :: MonadIO m => IO () -> m ProcessID #

A replacement for `forkProcess` which resets default signal handlers.

xmessage :: MonadIO m => String -> m () #

Use `xmessage` to show information to the user.

recompile :: MonadIO m => Directories -> Bool -> m Bool #

Recompile the xmonad configuration file when any of the following apply:

- force is `True`
- the xmonad executable does not exist
- the xmonad executable is older than `xmonad.hs` or any file in the `lib` directory (under the configuration directory)
- custom `build` script is being used

The -i flag is used to restrict recompilation to the xmonad.hs file only, and any files in the aforementioned `lib` directory.

Compilation errors (if any) are logged to the `xmonad.errors` file in the xmonad data directory. If GHC indicates failure with a non-zero exit code, an xmessage displaying that file is spawned.

`False` is returned if there are compilation errors.

trace :: MonadIO m => String -> m () #

A `trace` for the `X` monad. Logs a string to stderr. The result may be found in your .xsession-errors file

whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () #

Conditionally run an action, using a `Maybe a` to decide.

whenX :: X Bool -> X () -> X () #

Conditionally run an action, using a `X` event to decide

ifM :: Monad m => m Bool -> m a -> m a -> m a #

If-then-else lifted to a `Monad`.

getXMonadDir :: X String #

Deprecated: Use `asks (cfgDir . directories)' instead.

Return the path to the xmonad configuration directory.

getXMonadCacheDir :: X String #

Deprecated: Use `asks (cacheDir . directories)' instead.

Return the path to the xmonad cache directory.

getXMonadDataDir :: X String #

Deprecated: Use `asks (dataDir . directories)' instead.

Return the path to the xmonad data directory.

stateFileName :: Directories -> FilePath #

binFileName :: Directories -> FilePath #

atom_WM_STATE :: X Atom #

Common non-predefined atoms

atom_WM_PROTOCOLS :: X Atom #

Common non-predefined atoms

atom_WM_DELETE_WINDOW :: X Atom #

Common non-predefined atoms

atom_WM_TAKE_FOCUS :: X Atom #

Common non-predefined atoms

withWindowAttributes :: Display -> Window -> (WindowAttributes -> X ()) -> X () #

Safely access window attributes.

type ManageHook = Query (Endo WindowSet) #

newtype Query a #

Constructors

Query (ReaderT Window X a) |

#### Instances

Instances details

MonadIO Query # |
Instance details Defined in XMonad.Core Methods liftIO :: IO a -> Query a #
Applicative Query # |
Instance details Defined in XMonad.Core Methods pure :: a -> Query a # (<*>) :: Query (a -> b) -> Query a -> Query b # liftA2 :: (a -> b -> c) -> Query a -> Query b -> Query c # (*>) :: Query a -> Query b -> Query b # (<*) :: Query a -> Query b -> Query a #
Functor Query # |
Instance details Defined in XMonad.Core Methods fmap :: (a -> b) -> Query a -> Query b # (<$) :: a -> Query b -> Query a #
Monad Query # |
Instance details Defined in XMonad.Core Methods (>>=) :: Query a -> (a -> Query b) -> Query b # (>>) :: Query a -> Query b -> Query b # return :: a -> Query a #
MonadReader Window Query # |
Instance details Defined in XMonad.Core Methods ask :: Query Window # local :: (Window -> Window) -> Query a -> Query a # reader :: (Window -> a) -> Query a #
Default a => Default (Query a) # |
Instance details Defined in XMonad.Core Methods def :: Query a #
Monoid a => Monoid (Query a) # |
Instance details Defined in XMonad.Core Methods mempty :: Query a # mappend :: Query a -> Query a -> Query a # mconcat :: [Query a] -> Query a #
Semigroup a => Semigroup (Query a) # |
Instance details Defined in XMonad.Core Methods (<>) :: Query a -> Query a -> Query a # sconcat :: NonEmpty (Query a) -> Query a # stimes :: Integral b => b -> Query a -> Query a #

runQuery :: Query a -> Window -> X a #

data Directories' a #

All the directories that xmonad will use. They will be used for the following purposes:

- `dataDir`: This directory is used by XMonad to store data files such as the run-time state file.
- `cfgDir`: This directory is where user configuration files are stored (e.g, the xmonad.hs file). You may also create a `lib` subdirectory in the configuration directory and the default recompile command will add it to the GHC include path.
- `cacheDir`: This directory is used to store temporary files that can easily be recreated such as the configuration binary and any intermediate object files generated by GHC. Also, the XPrompt history file goes here.

For how these directories are chosen, see `getDirectories`.

Constructors

Directories |
Fields dataDir :: !a cfgDir :: !a cacheDir :: !a

#### Instances

Instances details

Functor Directories' # |
Instance details Defined in XMonad.Core Methods fmap :: (a -> b) -> Directories' a -> Directories' b # (<$) :: a -> Directories' b -> Directories' a #
Foldable Directories' # |
Instance details Defined in XMonad.Core Methods fold :: Monoid m => Directories' m -> m # foldMap :: Monoid m => (a -> m) -> Directories' a -> m # foldMap' :: Monoid m => (a -> m) -> Directories' a -> m # foldr :: (a -> b -> b) -> b -> Directories' a -> b # foldr' :: (a -> b -> b) -> b -> Directories' a -> b # foldl :: (b -> a -> b) -> b -> Directories' a -> b # foldl' :: (b -> a -> b) -> b -> Directories' a -> b # foldr1 :: (a -> a -> a) -> Directories' a -> a # foldl1 :: (a -> a -> a) -> Directories' a -> a # toList :: Directories' a -> [a] # null :: Directories' a -> Bool # length :: Directories' a -> Int # elem :: Eq a => a -> Directories' a -> Bool # maximum :: Ord a => Directories' a -> a # minimum :: Ord a => Directories' a -> a # sum :: Num a => Directories' a -> a # product :: Num a => Directories' a -> a #
Traversable Directories' # |
Instance details Defined in XMonad.Core Methods traverse :: Applicative f => (a -> f b) -> Directories' a -> f (Directories' b) # sequenceA :: Applicative f => Directories' (f a) -> f (Directories' a) # mapM :: Monad m => (a -> m b) -> Directories' a -> m (Directories' b) # sequence :: Monad m => Directories' (m a) -> m (Directories' a) #
Show a => Show (Directories' a) # |
Instance details Defined in XMonad.Core Methods showsPrec :: Int -> Directories' a -> ShowS # show :: Directories' a -> String # showList :: [Directories' a] -> ShowS #

type Directories = Directories' FilePath #

Convenient type alias for the most common case in which one might want to use the `Directories` type.

getDirectories :: IO Directories #

Build up the `Dirs` that xmonad will use. They are chosen as follows:

1. If all three of xmonad's environment variables (`XMONAD_DATA_DIR`, `XMONAD_CONFIG_DIR`, and `XMONAD_CACHE_DIR`) are set, use them.
2. If there is a build script called `build` or configuration `xmonad.hs` in `~/.xmonad`, set all three directories to `~/.xmonad`.
3. Otherwise, use the `xmonad` directory in `XDG_DATA_HOME`, `XDG_CONFIG_HOME`, and `XDG_CACHE_HOME` (or their respective fallbacks). These directories are created if necessary.

The xmonad configuration file (or the build script, if present) is always assumed to be in `cfgDir`.