| ||||||||||
| ||||||||||
| ||||||||||
| Description | ||||||||||
A layout modifier that implements an event hook at the layout level. Since it operates at the Workspace level, it will install itself on the first current Workspace and will broadcast a Message to all other Workspaces not to handle events. | ||||||||||
| Synopsis | ||||||||||
| ||||||||||
| Usage | ||||||||||
You can use this module with the following in your ~/.xmonad/xmonad.hs: import XMonad.Hooks.EventHook Then edit your layoutHook by adding the eventHook: layoutHook = eventHook EventHookExample $ avoidStruts $ simpleTabbed ||| Full ||| etc.. and then: main = xmonad defaultConfig { layoutHook = myLayouts }
For more detailed instructions on editing the layoutHook see: | ||||||||||
| Writing a hook | ||||||||||
Writing a hook is very simple. This is a basic example to log all events: data EventHookExample = EventHookExample deriving ( Show, Read )
instance EventHook EventHookExample where
handleEvent _ e = io $ hPutStrLn stderr . show $ e --return ()
This is an EventHook to log mouse button events: data EventHookButton = EventHookButton deriving ( Show, Read )
instance EventHook EventHookButton where
handleEvent _ (ButtonEvent {ev_window = w}) = do
io $ hPutStrLn stderr $ "This is a button event on window " ++ (show w)
handleEvent _ _ = return ()
Obviously you can compose event hooks: layoutHook = eventHook EventHookButton $ eventHook EventHookExample $ avoidStruts $ simpleTabbed ||| Full ||| etc.. | ||||||||||
| class (Read eh, Show eh) => EventHook eh where | ||||||||||
| ||||||||||
| eventHook :: EventHook eh => eh -> l a -> HandleEvent eh l a | ||||||||||
| data HandleEvent eh l a | ||||||||||
| ||||||||||
| Produced by Haddock version 0.8 |