xmonad-extras-0.0: Third party extensions for xmonad with wacky dependenciesSource codeContentsIndex
XMonad.Hooks.EvalServer
Portabilityunportable
Stabilityunstable
MaintainerDaniel Schoepe <daniel.schoepe@gmail.com>
Contents
Usage
Documentation
Description
This module allows controlling XMonad through Haskell expressions sent via a socket.
Synopsis
initEVData :: MonadIO m => m EvalServerData
startServer :: MonadIO m => EvalServerData -> PortID -> m ()
defaultServer :: MonadIO m => EvalServerData -> PortNumber -> m ()
defaultServerConfig :: EvalConfig
evalEventHook :: EvalConfig -> EvalServerData -> Event -> X All
data EvalServerData
Usage

WARNING: This module will have the following issue if xmonad wasn't compiled with -threaded (requires a modified xmonad-version): Expressions will only get evaluated when xmonad receives an event, for example when the focus changes.

This module is highly experimental and might not work as expected or even cause deadlocks when used with -threaded, due to the fact that xlib isn't reentrant.

This module lets you create a server that evaluates Haskell expressions in the context of the currently running xmonad instance, which lets you control xmonad from another process(e.g. a script). To use this module add something like this to your xmonad.hs:

 import XMonad.Hooks.EvalServer
 main = do
   evData <- initEVData
   ..
   xmonad $ .. $ defaultConfig {
                   handleEventHook = evalEventHook defaultServerConfig evData
                   startupHook = defaultServer evData 4242
   ..
   }

You can then send Haskell expressions that are to be evaluated over the socket. Example using telnet:

 telnet localhost 4242
 windows $ W.view "1"

By default, xmonad is not built with -threaded, so commands will only be executed after an event is received. xmonadcmd, which is included in this package, is a workaround to this problem. After sending the command, it also sends an event to the root window to trigger the execution of the command.

For more information run 'xmonadcmd --help'

Documentation
initEVData :: MonadIO m => m EvalServerDataSource
Creates the structure to store received commands and other data. A variable of this type has to be passed to the other functions of this module.
startServer :: MonadIO m => EvalServerData -> PortID -> m ()Source
Creates a server listening on the specified port(can also be a unix domain socket).
defaultServer :: MonadIO m => EvalServerData -> PortNumber -> m ()Source
Creates a server listening on a TCP socket with the given port number.
defaultServerConfig :: EvalConfigSource
Default config to evaluate the received expressions
evalEventHook :: EvalConfig -> EvalServerData -> Event -> X AllSource
This event hook causes commands to be executed when they are received.
data EvalServerData Source
Data type for storing information such as the socket and received commands
Produced by Haddock version 2.4.2