Copyright | (c) Peter Olson 2013 and Andrea Rossato and David Roundy 2007 |
---|---|
License | BSD-style (see xmonad/LICENSE) |
Maintainer | polson2@hawk.iit.edu |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell98 |
This is an EventHook
that will receive commands from an external
client. Also consider XMonad.Hooks.EwmhDesktops together with
wmctrl
.
See scripts/xmonadctl.hs
for the client.
Usage
You can use this module with the following in your
~/.xmonad/xmonad.hs
:
import XMonad.Hooks.ServerMode
Then edit your handleEventHook
by adding the appropriate event hook from below
serverModeEventHook :: Event -> X All Source #
Executes a command of the list when receiving its index via a special ClientMessageEvent
(indexing starts at 1). Sending index 0 will ask xmonad to print the list of command numbers
in stderr (so that you can read it in ~/.xsession-errors
). Uses XMonad.Actions.Commands as the default.
main = xmonad def { handleEventHook = serverModeEventHook }
xmonadctl 0 # tells xmonad to output command list xmonadctl 1 # tells xmonad to switch to workspace 1
serverModeEventHook' :: X [(String, X ())] -> Event -> X All Source #
serverModeEventHook' additionally takes an action to generate the list of commands.
serverModeEventHookCmd :: Event -> X All Source #
Executes a command of the list when receiving its name via a special ClientMessageEvent. Uses XMonad.Actions.Commands as the default.
main = xmonad def { handleEventHook = serverModeEventHookCmd }
xmonadctl run # Tells xmonad to generate a run prompt
serverModeEventHookCmd' :: X [(String, X ())] -> Event -> X All Source #
Additionally takes an action to generate the list of commands
serverModeEventHookF :: String -> (String -> X ()) -> Event -> X All Source #
Listens for an atom, then executes a callback function whenever it hears it. A trivial example that prints everything supplied to it on xmonad's standard out:
main = xmonad def { handleEventHook = serverModeEventHookF "XMONAD_PRINT" (io . putStrLn) }
xmonadctl -a XMONAD_PRINT "hello world"