-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A tiling window manager -- -- xmonad is a tiling window manager for X. Windows are arranged -- automatically to tile the screen without gaps or overlap, maximising -- screen use. All features of the window manager are accessible from the -- keyboard: a mouse is strictly optional. xmonad is written and -- extensible in Haskell. Custom layout algorithms, and other extensions, -- may be written by the user in config files. Layouts are applied -- dynamically, and different layouts may be used on each workspace. -- Xinerama is fully supported, allowing windows to be tiled on several -- screens. @package xmonad @version 0.13 module XMonad.StackSet -- | A cursor into a non-empty list of workspaces. -- -- We puncture the workspace list, producing a hole in the structure used -- to track the currently focused workspace. The two other lists that are -- produced are used to track those workspaces visible as Xinerama -- screens, and those workspaces not visible anywhere. data StackSet i l a sid sd StackSet :: !(Screen i l a sid sd) -> [Screen i l a sid sd] -> [Workspace i l a] -> Map a RationalRect -> StackSet i l a sid sd -- | currently focused workspace [current] :: StackSet i l a sid sd -> !(Screen i l a sid sd) -- | non-focused workspaces, visible in xinerama [visible] :: StackSet i l a sid sd -> [Screen i l a sid sd] -- | workspaces not visible anywhere [hidden] :: StackSet i l a sid sd -> [Workspace i l a] -- | floating windows [floating] :: StackSet i l a sid sd -> Map a RationalRect -- | A workspace is just a tag, a layout, and a stack. data Workspace i l a Workspace :: !i -> l -> Maybe (Stack a) -> Workspace i l a [tag] :: Workspace i l a -> !i [layout] :: Workspace i l a -> l [stack] :: Workspace i l a -> Maybe (Stack a) -- | Visible workspaces, and their Xinerama screens. data Screen i l a sid sd Screen :: !(Workspace i l a) -> !sid -> !sd -> Screen i l a sid sd [workspace] :: Screen i l a sid sd -> !(Workspace i l a) [screen] :: Screen i l a sid sd -> !sid [screenDetail] :: Screen i l a sid sd -> !sd -- | A stack is a cursor onto a window list. The data structure tracks -- focus by construction, and the master window is by convention the -- top-most item. Focus operations will not reorder the list that results -- from flattening the cursor. The structure can be envisaged as: -- --
--      +-- master:  < '7' >
--   up |            [ '2' ]
--      +---------   [ '3' ]
--   focus:          < '4' >
--   dn +----------- [ '8' ]
--   
-- -- A Stack can be viewed as a list with a hole punched in it to -- make the focused position. Under the zipper/calculus view of such -- structures, it is the differentiation of a [a], and integrating it -- back has a natural implementation used in index. data Stack a Stack :: !a -> [a] -> [a] -> Stack a [focus] :: Stack a -> !a [up] :: Stack a -> [a] [down] :: Stack a -> [a] -- | A structure for window geometries data RationalRect RationalRect :: Rational -> Rational -> Rational -> Rational -> RationalRect -- | O(n). Create a new stackset, of empty stacks, with given tags, -- with physical screens whose descriptions are given by m. The -- number of physical screens (length m) should be less -- than or equal to the number of workspace tags. The first workspace in -- the list will be current. -- -- Xinerama: Virtual workspaces are assigned to physical screens, -- starting at 0. new :: (Integral s) => l -> [i] -> [sd] -> StackSet i l a s sd -- | O(w). Set focus to the workspace with index 'i'. If the index -- is out of range, return the original StackSet. -- -- Xinerama: If the workspace is not visible on any Xinerama screen, it -- becomes the current screen. If it is in the visible list, it becomes -- current. view :: (Eq s, Eq i) => i -> StackSet i l a s sd -> StackSet i l a s sd -- | Set focus to the given workspace. If that workspace does not exist in -- the stackset, the original workspace is returned. If that workspace is -- hidden, then display that workspace on the current screen, and -- move the current workspace to hidden. If that workspace is -- visible on another screen, the workspaces of the current screen -- and the other screen are swapped. greedyView :: (Eq s, Eq i) => i -> StackSet i l a s sd -> StackSet i l a s sd -- | Find the tag of the workspace visible on Xinerama screen sc. -- Nothing if screen is out of bounds. lookupWorkspace :: Eq s => s -> StackSet i l a s sd -> Maybe i -- | Get a list of all screens in the StackSet. screens :: StackSet i l a s sd -> [Screen i l a s sd] -- | Get a list of all workspaces in the StackSet. workspaces :: StackSet i l a s sd -> [Workspace i l a] -- | Get a list of all windows in the StackSet in no particular -- order allWindows :: Eq a => StackSet i l a s sd -> [a] -- | Get the tag of the currently focused workspace. currentTag :: StackSet i l a s sd -> i -- | O(1). Extract the focused element of the current stack. Return -- Just that element, or Nothing for an empty stack. peek :: StackSet i l a s sd -> Maybe a -- | O(s). Extract the stack on the current workspace, as a list. -- The order of the stack is determined by the master window -- it will -- be the head of the list. The implementation is given by the natural -- integration of a one-hole list cursor, back to a list. index :: StackSet i l a s sd -> [a] -- | O(n). Flatten a Stack into a list. integrate :: Stack a -> [a] -- | O(n) Flatten a possibly empty stack into a list. integrate' :: Maybe (Stack a) -> [a] -- | O(n). Turn a list into a possibly empty stack (i.e., a zipper): -- the first element of the list is current, and the rest of the list is -- down. differentiate :: [a] -> Maybe (Stack a) -- | O(1), O(w) on the wrapping case. -- -- focusUp, focusDown. Move the window focus up or down the stack, -- wrapping if we reach the end. The wrapping should model a cycle -- on the current stack. The master window, and window order, -- are unaffected by movement of focus. -- -- swapUp, swapDown, swap the neighbour in the stack ordering, wrapping -- if we reach the end. Again the wrapping model should cycle on -- the current stack. focusUp :: StackSet i l a s sd -> StackSet i l a s sd -- | O(1), O(w) on the wrapping case. -- -- focusUp, focusDown. Move the window focus up or down the stack, -- wrapping if we reach the end. The wrapping should model a cycle -- on the current stack. The master window, and window order, -- are unaffected by movement of focus. -- -- swapUp, swapDown, swap the neighbour in the stack ordering, wrapping -- if we reach the end. Again the wrapping model should cycle on -- the current stack. focusDown :: StackSet i l a s sd -> StackSet i l a s sd -- | Variants of focusUp and focusDown that work on a -- Stack rather than an entire StackSet. focusUp' :: Stack a -> Stack a -- | Variants of focusUp and focusDown that work on a -- Stack rather than an entire StackSet. focusDown' :: Stack a -> Stack a -- | O(s). Set focus to the master window. focusMaster :: StackSet i l a s sd -> StackSet i l a s sd -- | O(1) on current window, O(n) in general. Focus the window -- w, and set its workspace as current. focusWindow :: (Eq s, Eq a, Eq i) => a -> StackSet i l a s sd -> StackSet i l a s sd -- | Is the given tag present in the StackSet? tagMember :: Eq i => i -> StackSet i l a s sd -> Bool -- | Rename a given tag if present in the StackSet. renameTag :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd -- | Ensure that a given set of workspace tags is present by renaming -- existing workspaces and/or creating new hidden workspaces as -- necessary. ensureTags :: Eq i => l -> [i] -> StackSet i l a s sd -> StackSet i l a s sd -- | O(n). Is a window in the StackSet? member :: Eq a => a -> StackSet i l a s sd -> Bool -- | O(1) on current window, O(n) in general. Return Just the -- workspace tag of the given window, or Nothing if the window is -- not in the StackSet. findTag :: Eq a => a -> StackSet i l a s sd -> Maybe i -- | Map a function on all the workspaces in the StackSet. mapWorkspace :: (Workspace i l a -> Workspace i l a) -> StackSet i l a s sd -> StackSet i l a s sd -- | Map a function on all the layouts in the StackSet. mapLayout :: (l -> l') -> StackSet i l a s sd -> StackSet i l' a s sd -- | O(n). (Complexity due to duplicate check). Insert a new element -- into the stack, above the currently focused element. The new element -- is given focus; the previously focused element is moved down. -- -- If the element is already in the stackset, the original stackset is -- returned unmodified. -- -- Semantics in Huet's paper is that insert doesn't move the cursor. -- However, we choose to insert above, and move the focus. insertUp :: Eq a => a -> StackSet i l a s sd -> StackSet i l a s sd -- | O(1) on current window, O(n) in general. Delete window -- w if it exists. There are 4 cases to consider: -- -- -- -- Behaviour with respect to the master: -- -- delete :: (Ord a) => a -> StackSet i l a s sd -> StackSet i l a s sd -- | Only temporarily remove the window from the stack, thereby not -- destroying special information saved in the Stackset delete' :: (Eq a) => a -> StackSet i l a s sd -> StackSet i l a s sd -- | O(n). 'filter p s' returns the elements of s such that -- p evaluates to True. Order is preserved, and focus -- moves as described for delete. filter :: (a -> Bool) -> Stack a -> Maybe (Stack a) -- | O(1), O(w) on the wrapping case. -- -- focusUp, focusDown. Move the window focus up or down the stack, -- wrapping if we reach the end. The wrapping should model a cycle -- on the current stack. The master window, and window order, -- are unaffected by movement of focus. -- -- swapUp, swapDown, swap the neighbour in the stack ordering, wrapping -- if we reach the end. Again the wrapping model should cycle on -- the current stack. swapUp :: StackSet i l a s sd -> StackSet i l a s sd -- | O(1), O(w) on the wrapping case. -- -- focusUp, focusDown. Move the window focus up or down the stack, -- wrapping if we reach the end. The wrapping should model a cycle -- on the current stack. The master window, and window order, -- are unaffected by movement of focus. -- -- swapUp, swapDown, swap the neighbour in the stack ordering, wrapping -- if we reach the end. Again the wrapping model should cycle on -- the current stack. swapDown :: StackSet i l a s sd -> StackSet i l a s sd -- | O(s). Set the master window to the focused window. The old -- master window is swapped in the tiling order with the focused window. -- Focus stays with the item moved. swapMaster :: StackSet i l a s sd -> StackSet i l a s sd -- | O(s). Set the master window to the focused window. The other -- windows are kept in order and shifted down on the stack, as if you -- just hit mod-shift-k a bunch of times. Focus stays with the item -- moved. shiftMaster :: StackSet i l a s sd -> StackSet i l a s sd -- | Apply a function, and a default value for Nothing, to modify -- the current stack. modify :: Maybe (Stack a) -> (Stack a -> Maybe (Stack a)) -> StackSet i l a s sd -> StackSet i l a s sd -- | Apply a function to modify the current stack if it isn't empty, and we -- don't want to empty it. modify' :: (Stack a -> Stack a) -> StackSet i l a s sd -> StackSet i l a s sd -- | Given a window, and its preferred rectangle, set it as floating A -- floating window should already be managed by the StackSet. float :: Ord a => a -> RationalRect -> StackSet i l a s sd -> StackSet i l a s sd -- | Clear the floating status of a window sink :: Ord a => a -> StackSet i l a s sd -> StackSet i l a s sd -- | O(w). shift. Move the focused element of the current stack to -- stack n, leaving it as the focused element on that stack. The -- item is inserted above the currently focused element on that -- workspace. The actual focused workspace doesn't change. If there is no -- element on the current stack, the original stackSet is returned. shift :: (Ord a, Eq s, Eq i) => i -> StackSet i l a s sd -> StackSet i l a s sd -- | O(n). shiftWin. Searches for the specified window w on -- all workspaces of the stackSet and moves it to stack n, -- leaving it as the focused element on that stack. The item is inserted -- above the currently focused element on that workspace. The actual -- focused workspace doesn't change. If the window is not found in the -- stackSet, the original stackSet is returned. shiftWin :: (Ord a, Eq s, Eq i) => i -> a -> StackSet i l a s sd -> StackSet i l a s sd -- | this function indicates to catch that an error is expected abort :: String -> a instance (GHC.Classes.Eq a, GHC.Classes.Eq l, GHC.Classes.Eq i, GHC.Classes.Eq sid, GHC.Classes.Eq sd) => GHC.Classes.Eq (XMonad.StackSet.StackSet i l a sid sd) instance (GHC.Classes.Ord a, GHC.Read.Read a, GHC.Read.Read l, GHC.Read.Read i, GHC.Read.Read sid, GHC.Read.Read sd) => GHC.Read.Read (XMonad.StackSet.StackSet i l a sid sd) instance (GHC.Show.Show a, GHC.Show.Show l, GHC.Show.Show i, GHC.Show.Show sid, GHC.Show.Show sd) => GHC.Show.Show (XMonad.StackSet.StackSet i l a sid sd) instance (GHC.Classes.Eq sd, GHC.Classes.Eq sid, GHC.Classes.Eq i, GHC.Classes.Eq l, GHC.Classes.Eq a) => GHC.Classes.Eq (XMonad.StackSet.Screen i l a sid sd) instance (GHC.Read.Read sd, GHC.Read.Read sid, GHC.Read.Read i, GHC.Read.Read l, GHC.Read.Read a) => GHC.Read.Read (XMonad.StackSet.Screen i l a sid sd) instance (GHC.Show.Show sd, GHC.Show.Show sid, GHC.Show.Show i, GHC.Show.Show l, GHC.Show.Show a) => GHC.Show.Show (XMonad.StackSet.Screen i l a sid sd) instance (GHC.Classes.Eq a, GHC.Classes.Eq l, GHC.Classes.Eq i) => GHC.Classes.Eq (XMonad.StackSet.Workspace i l a) instance (GHC.Read.Read a, GHC.Read.Read l, GHC.Read.Read i) => GHC.Read.Read (XMonad.StackSet.Workspace i l a) instance (GHC.Show.Show a, GHC.Show.Show l, GHC.Show.Show i) => GHC.Show.Show (XMonad.StackSet.Workspace i l a) instance GHC.Classes.Eq a => GHC.Classes.Eq (XMonad.StackSet.Stack a) instance GHC.Read.Read a => GHC.Read.Read (XMonad.StackSet.Stack a) instance GHC.Show.Show a => GHC.Show.Show (XMonad.StackSet.Stack a) instance GHC.Classes.Eq XMonad.StackSet.RationalRect instance GHC.Read.Read XMonad.StackSet.RationalRect instance GHC.Show.Show XMonad.StackSet.RationalRect -- | The X monad, a state monad transformer over IO, for the -- window manager state, and support routines. module XMonad.Core -- | 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. data X a type WindowSet = StackSet WorkspaceId (Layout Window) Window ScreenId ScreenDetail type WindowSpace = Workspace WorkspaceId (Layout Window) Window -- | Virtual workspace indices type WorkspaceId = String -- | Physical screen indices newtype ScreenId S :: Int -> ScreenId -- | The Rectangle with screen dimensions data ScreenDetail SD :: !Rectangle -> ScreenDetail [screenRect] :: ScreenDetail -> !Rectangle -- | XState, the (mutable) window manager state. data XState XState :: !WindowSet -> !(Set Window) -> !(Map Window Int) -> !(Maybe (Position -> Position -> X (), X ())) -> !KeyMask -> !(Map String (Either String StateExtension)) -> XState -- | workspace list [windowset] :: XState -> !WindowSet -- | the Set of mapped windows [mapped] :: XState -> !(Set Window) -- | the number of expected UnmapEvents [waitingUnmap] :: XState -> !(Map Window Int) [dragging] :: XState -> !(Maybe (Position -> Position -> X (), X ())) -- | The numlock modifier [numberlockMask] :: XState -> !KeyMask -- | stores custom state information. -- -- The module XMonad.Utils.ExtensibleState in xmonad-contrib -- provides additional information and a simple interface for using this. [extensibleState] :: XState -> !(Map String (Either String StateExtension)) -- | XConf, the (read-only) window manager configuration. data XConf XConf :: Display -> !(XConfig Layout) -> !Window -> !Pixel -> !Pixel -> !(Map (KeyMask, KeySym) (X ())) -> !(Map (KeyMask, Button) (Window -> X ())) -> !Bool -> !(Maybe (Position, Position)) -> !(Maybe Event) -> XConf -- | the X11 display [display] :: XConf -> Display -- | initial user configuration [config] :: XConf -> !(XConfig Layout) -- | the root window [theRoot] :: XConf -> !Window -- | border color of unfocused windows [normalBorder] :: XConf -> !Pixel -- | border color of the focused window [focusedBorder] :: XConf -> !Pixel -- | a mapping of key presses to actions [keyActions] :: XConf -> !(Map (KeyMask, KeySym) (X ())) -- | a mapping of button presses to actions [buttonActions] :: XConf -> !(Map (KeyMask, Button) (Window -> X ())) -- | was refocus caused by mouse action? [mouseFocused] :: XConf -> !Bool -- | position of the mouse according to the event currently being processed [mousePosition] :: XConf -> !(Maybe (Position, Position)) -- | event currently being processed [currentEvent] :: XConf -> !(Maybe Event) data XConfig l XConfig :: !String -> !String -> !String -> !(l Window) -> !ManageHook -> !(Event -> X All) -> ![String] -> !KeyMask -> !(XConfig Layout -> Map (ButtonMask, KeySym) (X ())) -> !(XConfig Layout -> Map (ButtonMask, Button) (Window -> X ())) -> !Dimension -> !(X ()) -> !(X ()) -> !Bool -> !Bool -> !EventMask -> !EventMask -> !([String] -> XConfig Layout -> IO (XConfig Layout)) -> XConfig l -- | Non focused windows border color. Default: "#dddddd" [normalBorderColor] :: XConfig l -> !String -- | Focused windows border color. Default: "#ff0000" [focusedBorderColor] :: XConfig l -> !String -- | The preferred terminal application. Default: "xterm" [terminal] :: XConfig l -> !String -- | The available layouts [layoutHook] :: XConfig l -> !(l Window) -- | The action to run when a new window is opened [manageHook] :: XConfig l -> !ManageHook -- | 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. [handleEventHook] :: XConfig l -> !(Event -> X All) -- | The list of workspaces' names [workspaces] :: XConfig l -> ![String] -- | the mod modifier [modMask] :: XConfig l -> !KeyMask -- | The key binding: a map from key presses and actions [keys] :: XConfig l -> !(XConfig Layout -> Map (ButtonMask, KeySym) (X ())) -- | The mouse bindings [mouseBindings] :: XConfig l -> !(XConfig Layout -> Map (ButtonMask, Button) (Window -> X ())) -- | The border width [borderWidth] :: XConfig l -> !Dimension -- | The action to perform when the windows set is changed [logHook] :: XConfig l -> !(X ()) -- | The action to perform on startup [startupHook] :: XConfig l -> !(X ()) -- | Whether window entry events can change focus [focusFollowsMouse] :: XConfig l -> !Bool -- | False to make a click which changes focus to be additionally passed to -- the window [clickJustFocuses] :: XConfig l -> !Bool -- | The client events that xmonad is interested in [clientMask] :: XConfig l -> !EventMask -- | The root events that xmonad is interested in [rootMask] :: XConfig l -> !EventMask -- | Modify the configuration, complain about extra arguments etc. with -- arguments that are not handled by default [handleExtraArgs] :: XConfig l -> !([String] -> XConfig Layout -> IO (XConfig Layout)) -- | Every layout must be an instance of LayoutClass, which defines -- the basic layout operations along with a sensible default for each. -- -- Minimal complete definition: -- -- -- -- You should also strongly consider implementing description, -- although it is not required. -- -- 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. class Show (layout a) => LayoutClass layout a where runLayout (Workspace _ l ms) r = maybe (emptyLayout l r) (doLayout l r) ms doLayout l r s = return (pureLayout l r s, Nothing) pureLayout _ r s = [(focus s, r)] emptyLayout _ _ = return ([], Nothing) handleMessage l = return . pureMessage l pureMessage _ _ = Nothing description = show -- | 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). runLayout :: LayoutClass layout a => Workspace WorkspaceId (layout a) a -> Rectangle -> 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. doLayout :: LayoutClass layout a => layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a)) -- | 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. pureLayout :: LayoutClass layout a => layout a -> Rectangle -> Stack a -> [(a, Rectangle)] -- | emptyLayout is called when there are no windows. emptyLayout :: LayoutClass layout a => layout a -> Rectangle -> X ([(a, Rectangle)], 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). handleMessage :: LayoutClass layout a => layout a -> SomeMessage -> X (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. pureMessage :: LayoutClass layout a => layout a -> SomeMessage -> Maybe (layout a) -- | 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. description :: LayoutClass layout a => layout a -> String -- | An existential type that can hold any object that is in Read -- and LayoutClass. data Layout a Layout :: (l a) -> Layout a -- | Using the Layout as a witness, parse existentially wrapped -- windows from a String. readsLayout :: Layout a -> String -> [(Layout a, String)] -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable k (a :: k) -- | 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. class Typeable a => Message a -- | A wrapped value of some type in the Message class. data SomeMessage SomeMessage :: a -> SomeMessage -- | And now, unwrap a given, unknown Message type, performing a -- (dynamic) type check on the result. fromMessage :: Message m => SomeMessage -> Maybe m -- | LayoutMessages are core messages that all layouts (especially -- stateful layouts) should consider handling. data LayoutMessages -- | sent when a layout becomes non-visible Hide :: LayoutMessages -- | sent when xmonad is exiting or restarting ReleaseResources :: LayoutMessages -- | Existential type to store a state extension. data StateExtension -- | Non-persistent state extension StateExtension :: a -> StateExtension -- | Persistent extension PersistentExtension :: a -> StateExtension -- | Every module must make the data it wants to store an instance of this -- class. -- -- Minimal complete definition: initialValue class Typeable a => ExtensionClass a where extensionType = StateExtension -- | Defines an initial value for the state extension initialValue :: ExtensionClass a => a -- | 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. extensionType :: ExtensionClass a => a -> StateExtension -- | Run the X monad, given a chunk of X monad code, and an -- initial state Return the result, and final state runX :: XConf -> XState -> X a -> IO (a, XState) -- | Run in the X monad, and in case of exception, and catch it and -- log it to stderr, and run the error case. catchX :: X a -> X a -> X a -- | Execute the argument, catching all exceptions. Either this function or -- catchX should be used at all callsites of user customized code. userCode :: X a -> X (Maybe a) -- | Same as userCode but with a default argument to return instead of -- using Maybe, provided for convenience. userCodeDef :: a -> X a -> X a -- | General utilities -- -- Lift an IO action into the X monad io :: MonadIO m => IO a -> m a -- | 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. catchIO :: MonadIO m => IO () -> m () -- | Ignore SIGPIPE to avoid termination when a pipe is full, and SIGCHLD -- to avoid zombie processes, and clean up any extant zombie processes. installSignalHandlers :: MonadIO m => m () uninstallSignalHandlers :: MonadIO m => m () -- | Run a monad action with the current display settings withDisplay :: (Display -> X a) -> X a -- | Run a monadic action with the current stack set withWindowSet :: (WindowSet -> X a) -> X a -- | True if the given window is the root window isRoot :: Window -> X Bool -- | 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. runOnWorkspaces :: (WindowSpace -> X WindowSpace) -> X () -- | Wrapper for the common case of atom internment getAtom :: String -> X Atom -- | 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. spawn :: MonadIO m => String -> m () -- | Like spawn, but returns the ProcessID of the launched -- application spawnPID :: MonadIO m => String -> m ProcessID -- | A replacement for forkProcess which resets default signal -- handlers. xfork :: MonadIO m => IO () -> m ProcessID -- | 'recompile force', recompile the xmonad configuration file when any of -- the following apply: -- -- -- -- 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. recompile :: MonadIO m => Bool -> m Bool -- | A trace for the X monad. Logs a string to stderr. The -- result may be found in your .xsession-errors file trace :: MonadIO m => String -> m () -- | Conditionally run an action, using a Maybe a to decide. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | Conditionally run an action, using a X event to decide whenX :: X Bool -> X () -> X () -- | Return the path to the xmonad configuration directory. 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. -- -- Several directories are considered. In order of preference: -- --
    --
  1. The directory specified in the XMONAD_CONFIG_DIR -- environment variable.
  2. --
  3. The ~/.xmonad directory.
  4. --
  5. The XDG_CONFIG_HOME/xmonad directory.
  6. --
-- -- The first directory that exists will be used. If none of the -- directories exist then (1) will be used if it is set, otherwise (2) -- will be used. Either way, a directory will be created if necessary. getXMonadDir :: MonadIO m => m String -- | Return the path to the xmonad cache directory. This directory is used -- to store temporary files that can easily be recreated. For example, -- the XPrompt history file. -- -- Several directories are considered. In order of preference: -- --
    --
  1. The directory specified in the XMONAD_CACHE_DIR -- environment variable.
  2. --
  3. The ~/.xmonad directory.
  4. --
  5. The XDG_CACHE_HOME/xmonad directory.
  6. --
-- -- The first directory that exists will be used. If none of the -- directories exist then (1) will be used if it is set, otherwise (2) -- will be used. Either way, a directory will be created if necessary. getXMonadCacheDir :: MonadIO m => m String -- | Return the path to the xmonad data directory. This directory is used -- by XMonad to store data files such as the run-time state file and the -- configuration binary generated by GHC. -- -- Several directories are considered. In order of preference: -- --
    --
  1. The directory specified in the XMONAD_DATA_DIR -- environment variable.
  2. --
  3. The ~/.xmonad directory.
  4. --
  5. The XDG_DATA_HOME/xmonad directory.
  6. --
-- -- The first directory that exists will be used. If none of the -- directories exist then (1) will be used if it is set, otherwise (2) -- will be used. Either way, a directory will be created if necessary. getXMonadDataDir :: MonadIO m => m String -- | Get the name of the file used to store the xmonad window state. stateFileName :: (Functor m, MonadIO m) => m FilePath -- | Common non-predefined atoms 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 -- | Safely access window attributes. withWindowAttributes :: Display -> Window -> (WindowAttributes -> X ()) -> X () type ManageHook = Query (Endo WindowSet) newtype Query a Query :: (ReaderT Window X a) -> Query a runQuery :: Query a -> Window -> X a instance Control.Monad.IO.Class.MonadIO XMonad.Core.Query instance Control.Monad.Reader.Class.MonadReader Graphics.X11.Types.Window XMonad.Core.Query instance GHC.Base.Monad XMonad.Core.Query instance GHC.Base.Applicative XMonad.Core.Query instance GHC.Base.Functor XMonad.Core.Query instance Control.Monad.Reader.Class.MonadReader XMonad.Core.XConf XMonad.Core.X instance Control.Monad.State.Class.MonadState XMonad.Core.XState XMonad.Core.X instance Control.Monad.IO.Class.MonadIO XMonad.Core.X instance GHC.Base.Monad XMonad.Core.X instance GHC.Base.Functor XMonad.Core.X instance GHC.Classes.Eq XMonad.Core.LayoutMessages instance GHC.Read.Read XMonad.Core.ScreenDetail instance GHC.Show.Show XMonad.Core.ScreenDetail instance GHC.Classes.Eq XMonad.Core.ScreenDetail instance GHC.Real.Real XMonad.Core.ScreenId instance GHC.Real.Integral XMonad.Core.ScreenId instance GHC.Num.Num XMonad.Core.ScreenId instance GHC.Enum.Enum XMonad.Core.ScreenId instance GHC.Read.Read XMonad.Core.ScreenId instance GHC.Show.Show XMonad.Core.ScreenId instance GHC.Classes.Ord XMonad.Core.ScreenId instance GHC.Classes.Eq XMonad.Core.ScreenId instance GHC.Base.Applicative XMonad.Core.X instance GHC.Base.Monoid a => GHC.Base.Monoid (XMonad.Core.X a) instance Data.Default.Class.Default a => Data.Default.Class.Default (XMonad.Core.X a) instance GHC.Base.Monoid a => GHC.Base.Monoid (XMonad.Core.Query a) instance Data.Default.Class.Default a => Data.Default.Class.Default (XMonad.Core.Query a) instance XMonad.Core.LayoutClass XMonad.Core.Layout Graphics.X11.Types.Window instance GHC.Show.Show (XMonad.Core.Layout a) instance XMonad.Core.Message Graphics.X11.Xlib.Extras.Event instance XMonad.Core.Message XMonad.Core.LayoutMessages -- | The collection of core layouts. module XMonad.Layout -- | Simple fullscreen mode. Renders the focused window fullscreen. data Full a Full :: Full a -- | The builtin tiling mode of xmonad. Supports Shrink, -- Expand and IncMasterN. data Tall a Tall :: !Int -> !Rational -> !Rational -> Tall a -- | The default number of windows in the master pane (default: 1) [tallNMaster] :: Tall a -> !Int -- | Percent of screen to increment by when resizing panes (default: 3/100) [tallRatioIncrement] :: Tall a -> !Rational -- | Default proportion of screen occupied by master pane (default: 1/2) [tallRatio] :: Tall a -> !Rational -- | Mirror a layout, compute its 90 degree rotated form. newtype Mirror l a Mirror :: (l a) -> Mirror l a -- | Change the size of the master pane. data Resize Shrink :: Resize Expand :: Resize -- | Increase the number of clients in the master pane. data IncMasterN IncMasterN :: !Int -> IncMasterN -- | A layout that allows users to switch between various layout options. data Choose l r a -- | The layout choice combinator (|||) :: l a -> r a -> Choose l r a infixr 5 ||| -- | Messages to change the current layout. data ChangeLayout FirstLayout :: ChangeLayout NextLayout :: ChangeLayout -- | Mirror a rectangle. mirrorRect :: Rectangle -> Rectangle splitVertically :: Int -> Rectangle -> [Rectangle] splitHorizontally :: Int -> Rectangle -> [Rectangle] splitHorizontallyBy :: RealFrac r => r -> Rectangle -> (Rectangle, Rectangle) splitVerticallyBy :: RealFrac r => r -> Rectangle -> (Rectangle, Rectangle) -- | Compute the positions for windows using the default two-pane tiling -- algorithm. -- -- The screen is divided into two panes. All clients are then partioned -- between these two panes. One pane, the master, by convention has the -- least number of windows in it. tile :: Rational -> Rectangle -> Int -> Int -> [Rectangle] instance GHC.Show.Show XMonad.Layout.NextNoWrap instance GHC.Classes.Eq XMonad.Layout.NextNoWrap instance (GHC.Show.Show (r a), GHC.Show.Show (l a)) => GHC.Show.Show (XMonad.Layout.Choose l r a) instance (GHC.Read.Read (r a), GHC.Read.Read (l a)) => GHC.Read.Read (XMonad.Layout.Choose l r a) instance GHC.Classes.Eq XMonad.Layout.LR instance GHC.Show.Show XMonad.Layout.LR instance GHC.Read.Read XMonad.Layout.LR instance GHC.Show.Show XMonad.Layout.ChangeLayout instance GHC.Classes.Eq XMonad.Layout.ChangeLayout instance GHC.Read.Read (l a) => GHC.Read.Read (XMonad.Layout.Mirror l a) instance GHC.Show.Show (l a) => GHC.Show.Show (XMonad.Layout.Mirror l a) instance GHC.Read.Read (XMonad.Layout.Tall a) instance GHC.Show.Show (XMonad.Layout.Tall a) instance GHC.Read.Read (XMonad.Layout.Full a) instance GHC.Show.Show (XMonad.Layout.Full a) instance XMonad.Core.Message XMonad.Layout.Resize instance XMonad.Core.Message XMonad.Layout.IncMasterN instance XMonad.Core.LayoutClass XMonad.Layout.Full a instance XMonad.Core.LayoutClass XMonad.Layout.Tall a instance XMonad.Core.LayoutClass l a => XMonad.Core.LayoutClass (XMonad.Layout.Mirror l) a instance XMonad.Core.Message XMonad.Layout.ChangeLayout instance XMonad.Core.Message XMonad.Layout.NextNoWrap instance (XMonad.Core.LayoutClass l a, XMonad.Core.LayoutClass r a) => XMonad.Core.LayoutClass (XMonad.Layout.Choose l r) a -- | Operations. module XMonad.Operations -- | Window manager operations manage. 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. manage :: Window -> X () -- | unmanage. A window no longer exists, remove it from the window list, -- on whatever workspace it is. unmanage :: 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) killWindow :: Window -> X () -- | Kill the currently focused client. kill :: X () -- | windows. Modify the current window list with a pure function, and -- refresh windows :: (WindowSet -> WindowSet) -> X () -- | Produce the actual rectangle from a screen and a ratio on that screen. scaleRationalRect :: Rectangle -> RationalRect -> Rectangle -- | setWMState. set the WM_STATE property setWMState :: Window -> Int -> X () -- | Set the border color using the window's color map, if possible, -- otherwise fallback to the color in Pixel. setWindowBorderWithFallback :: Display -> Window -> String -> Pixel -> X () -- | hide. Hide a window by unmapping it, and setting Iconified. hide :: Window -> X () -- | reveal. Show a window by mapping it and setting Normal this is -- harmless if the window was already visible reveal :: Window -> X () -- | Set some properties when we initially gain control of a window setInitialProperties :: Window -> X () -- | refresh. 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. refresh :: X () -- | clearEvents. Remove all events of a given type from the event queue. clearEvents :: EventMask -> X () -- | tileWindow. Moves and resizes w such that it fits inside the given -- rectangle, including its border. tileWindow :: Window -> Rectangle -> X () -- | Returns True if the first rectangle is contained within, but -- not equal to the second. containedIn :: Rectangle -> Rectangle -> Bool -- | Given a list of screens, remove all duplicated screens and screens -- that are entirely contained within another. nubScreens :: [Rectangle] -> [Rectangle] -- | Cleans the list of screens according to the rules documented for -- nubScreens. getCleanedScreenInfo :: MonadIO m => Display -> m [Rectangle] -- | rescreen. The screen configuration may have changed (due to xrandr), -- update the state and refresh the screen, and reset the gap. rescreen :: X () -- | setButtonGrab. Tell whether or not to intercept clicks on a given -- window setButtonGrab :: Bool -> Window -> X () -- | Set the focus to the window on top of the stack, or root setTopFocus :: 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). focus :: Window -> X () -- | Call X to set the keyboard focus details. setFocusX :: Window -> X () -- | Throw a message to the current LayoutClass possibly modifying -- how we layout the windows, then refresh. sendMessage :: Message a => a -> X () -- | Send a message to all layouts, without refreshing. broadcastMessage :: Message a => a -> X () -- | Send a message to a layout, without refreshing. sendMessageWithNoRefresh :: Message a => a -> Workspace WorkspaceId (Layout Window) Window -> X () -- | Update the layout field of a workspace updateLayout :: WorkspaceId -> Maybe (Layout Window) -> X () -- | Set the layout of the currently viewed workspace setLayout :: Layout Window -> X () -- | Return workspace visible on screen sc, or Nothing. screenWorkspace :: ScreenId -> X (Maybe WorkspaceId) -- | Apply an X operation to the currently focused window, if there -- is one. withFocused :: (Window -> X ()) -> X () -- | True if window is under management by us isClient :: Window -> X Bool -- | Combinations of extra modifier masks we need to grab keys/buttons for. -- (numlock and capslock) extraModifiers :: X [KeyMask] -- | Strip numlock/capslock from a mask cleanMask :: KeyMask -> X KeyMask -- | Get the Pixel value for a named color initColor :: Display -> String -> IO (Maybe Pixel) -- | A type to help serialize xmonad's state to a file. data StateFile StateFile :: StackSet WorkspaceId String Window ScreenId ScreenDetail -> [(String, String)] -> StateFile [sfWins] :: StateFile -> StackSet WorkspaceId String Window ScreenId ScreenDetail [sfExt] :: StateFile -> [(String, String)] -- | Write the current window state (and extensible state) to a file so -- that xmonad can resume with that state intact. writeStateToFile :: X () -- | Read the state of a previous xmonad instance from a file and return -- that state. readStateFile :: (LayoutClass l Window, Read (l Window)) => XConfig l -> X (Maybe XState) -- | Migrate state from a previously running xmonad instance that used the -- older --resume technique. -- | Deprecated: will be removed some point in the future. migrateState :: (Functor m, MonadIO m) => String -> String -> m () -- | restart name resume. Attempt 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. restart :: String -> Bool -> X () -- | Floating layer support -- -- Given a window, find the screen it is located on, and compute the -- geometry of that window wrt. that screen. floatLocation :: Window -> X (ScreenId, RationalRect) -- | Given a point, determine the screen (if any) that contains it. pointScreen :: Position -> Position -> X (Maybe (Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail)) -- | pointWithin x y r returns True if the (x, y) -- co-ordinate is within r. pointWithin :: Position -> Position -> Rectangle -> Bool -- | Make a tiled window floating, using its suggested rectangle float :: Window -> X () -- | Accumulate mouse motion events mouseDrag :: (Position -> Position -> X ()) -> X () -> X () -- | drag the window under the cursor with the mouse while it is dragged mouseMoveWindow :: Window -> X () -- | resize the window under the cursor with the mouse while it is dragged mouseResizeWindow :: Window -> X () -- | Support for window size hints type D = (Dimension, Dimension) -- | Given a window, build an adjuster function that will reduce the given -- dimensions according to the window's border width and size hints. mkAdjust :: Window -> X (D -> D) -- | Reduce the dimensions if needed to comply to the given SizeHints, -- taking window borders into account. applySizeHints :: Integral a => Dimension -> SizeHints -> (a, a) -> D -- | Reduce the dimensions if needed to comply to the given SizeHints. applySizeHintsContents :: Integral a => SizeHints -> (a, a) -> D -- | XXX comment me applySizeHints' :: SizeHints -> D -> D -- | Reduce the dimensions so their aspect ratio falls between the two -- given aspect ratios. applyAspectHint :: (D, D) -> D -> D -- | Reduce the dimensions so they are a multiple of the size increments. applyResizeIncHint :: D -> D -> D -- | Reduce the dimensions if they exceed the given maximum dimensions. applyMaxSizeHint :: D -> D -> D instance GHC.Read.Read XMonad.Operations.StateFile instance GHC.Show.Show XMonad.Operations.StateFile -- | An EDSL for ManageHooks module XMonad.ManageHook -- | Lift an X action to a Query. liftX :: X a -> Query a -- | The identity hook that returns the WindowSet unchanged. idHook :: Monoid m => m -- | Infix mappend. Compose two ManageHook from right to -- left. (<+>) :: Monoid m => m -> m -> m -- | Compose the list of ManageHooks. composeAll :: Monoid m => [m] -> m -- | p --> x. If p returns True, execute the -- ManageHook. -- --
--   (-->) :: Monoid m => Query Bool -> Query m -> Query m -- a simpler type
--   
(-->) :: (Monad m, Monoid a) => m Bool -> m a -> m a infix 0 --> -- | q =? x. if the result of q equals x, return -- True. (=?) :: Eq a => Query a -> a -> Query Bool -- | && lifted to a Monad. (<&&>) :: Monad m => m Bool -> m Bool -> m Bool infixr 3 <&&> -- | || lifted to a Monad. (<||>) :: Monad m => m Bool -> m Bool -> m Bool infixr 3 <||> -- | Return the window title. title :: Query String -- | Return the application name. appName :: Query String -- | Backwards compatible alias for appName. resource :: Query String -- | Return the resource class. className :: Query String -- | A query that can return an arbitrary X property of type String, -- identified by name. stringProperty :: String -> Query String getStringProperty :: Display -> Window -> String -> X (Maybe String) -- | Modify the WindowSet with a pure function. doF :: (s -> s) -> Query (Endo s) -- | Move the window to the floating layer. doFloat :: ManageHook -- | Map the window and remove it from the WindowSet. doIgnore :: ManageHook -- | Move the window to a given workspace doShift :: WorkspaceId -> ManageHook -- | This module specifies the default configuration values for xmonad. -- -- DO NOT MODIFY THIS FILE! It won't work. You may configure xmonad by -- providing your own ~/.xmonad/xmonad.hs that overrides -- specific fields in the default config, def. For a starting -- point, you can copy the xmonad.hs found in the man -- directory, or look at examples on the xmonad wiki. module XMonad.Config -- | The default set of configuration values itself -- | Deprecated: Use def (from Data.Default, and re-exported by XMonad -- and XMonad.Config) instead. defaultConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full)) -- | A class for types with a default value. class Default a -- | The default value for this type. def :: Default a => a instance a ~ XMonad.Layout.Choose XMonad.Layout.Tall (XMonad.Layout.Choose (XMonad.Layout.Mirror XMonad.Layout.Tall) XMonad.Layout.Full) => Data.Default.Class.Default (XMonad.Core.XConfig a) -- | xmonad, a minimalist, tiling window manager for X11 module XMonad.Main -- | | The entry point into xmonad. Attempts to compile any custom main for -- xmonad, and if it doesn't find one, just launches the default. xmonad :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO () -- | Entry point into xmonad for custom builds. -- -- This function isn't meant to be called by the typical xmonad user -- because it: -- -- -- -- Unless you know what you are doing, you should probably be using the -- xmonad function instead. -- -- However, if you are using a custom build environment (such as stack, -- cabal, make, etc.) you will likely want to call this function instead -- of xmonad. You probably also want to have a key binding to the -- restart function that restarts your custom binary with the -- resume flag set to True. launch :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO () module XMonad -- | Bitwise "or" (.|.) :: Bits a => a -> a -> a -- | Minimal definition is either both of get and put or -- just state class Monad m => MonadState s (m :: * -> *) | m -> s -- | Return the state from the internals of the monad. get :: MonadState s m => m s -- | Replace the state inside the monad. put :: MonadState s m => s -> m () -- | Embed a simple state action into the monad. state :: MonadState s m => (s -> (a, s)) -> m a -- | Gets specific component of the state, using a projection function -- supplied. gets :: MonadState s m => (s -> a) -> m a -- | Monadic state transformer. -- -- Maps an old state to a new state inside a state monad. The old state -- is thrown away. -- --
--   Main> :t modify ((+1) :: Int -> Int)
--   modify (...) :: (MonadState Int a) => a ()
--   
-- -- This says that modify (+1) acts over any Monad that is a -- member of the MonadState class, with an Int state. modify :: MonadState s m => (s -> s) -> m () -- | See examples in Control.Monad.Reader. Note, the partially -- applied function type (->) r is a simple reader monad. See -- the instance declaration below. class Monad m => MonadReader r (m :: * -> *) | m -> r -- | Retrieves the monad environment. ask :: MonadReader r m => m r -- | Executes a computation in a modified environment. local :: MonadReader r m => (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader r m => (r -> a) -> m a -- | Retrieves a function of the current environment. asks :: MonadReader r m => (r -> a) -> m a -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: * -> *) -- | Lift a computation from the IO monad. liftIO :: MonadIO m => IO a -> m a