diff options
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Config/Arossato.hs | 3 | ||||
-rw-r--r-- | XMonad/Hooks/ServerMode.hs | 14 |
2 files changed, 11 insertions, 6 deletions
diff --git a/XMonad/Config/Arossato.hs b/XMonad/Config/Arossato.hs index c1cbd75..4aa0087 100644 --- a/XMonad/Config/Arossato.hs +++ b/XMonad/Config/Arossato.hs @@ -24,7 +24,6 @@ import qualified Data.Map as M import XMonad hiding ( (|||) ) import qualified XMonad.StackSet as W -import XMonad.Actions.Commands import XMonad.Actions.CycleWS import XMonad.Hooks.DynamicLog hiding (xmobar) import XMonad.Hooks.ManageDocks @@ -99,7 +98,7 @@ arossatoConfig = do , normalBorderColor = "white" , focusedBorderColor = "black" , keys = newKeys - , handleEventHook = serverModeEventHook defaultCommands + , handleEventHook = serverModeEventHook , focusFollowsMouse = False } where diff --git a/XMonad/Hooks/ServerMode.hs b/XMonad/Hooks/ServerMode.hs index cb99831..4b216e6 100644 --- a/XMonad/Hooks/ServerMode.hs +++ b/XMonad/Hooks/ServerMode.hs @@ -60,6 +60,7 @@ module XMonad.Hooks.ServerMode -- $usage ServerMode (..) , serverModeEventHook + , serverModeEventHook' ) where import Control.Monad (when) @@ -79,15 +80,20 @@ import XMonad.Actions.Commands -- -- Then edit your @handleEventHook@ by adding the 'serverModeEventHook': -- --- > main = xmonad defaultConfig { handleEventHook = serverModeEventHook defaultCommands } +-- > main = xmonad defaultConfig { handleEventHook = serverModeEventHook } -- data ServerMode = ServerMode deriving ( Show, Read ) -- | Executes a command of the list when receiving its index via a special ClientMessageEvent -- (indexing starts at 1) -serverModeEventHook :: X [(String,X ())] -> Event -> X All -serverModeEventHook cmdAction (ClientMessageEvent {ev_message_type = mt, ev_data = dt}) = do +serverModeEventHook :: Event -> X All +serverModeEventHook = serverModeEventHook' defaultCommands + +-- | serverModeEventHook' additionally takes an action to generate the list of +-- commands. +serverModeEventHook' :: X [(String,X ())] -> Event -> X All +serverModeEventHook' cmdAction (ClientMessageEvent {ev_message_type = mt, ev_data = dt}) = do d <- asks display a <- io $ internAtom d "XMONAD_COMMAND" False when (mt == a && dt /= []) $ do @@ -97,4 +103,4 @@ serverModeEventHook cmdAction (ClientMessageEvent {ev_message_type = mt, ev_data Just (c,_) -> runCommand' c Nothing -> mapM_ (io . hPutStrLn stderr) . listOfCommands $ cl return (All True) -serverModeEventHook _ _ = return (All True) +serverModeEventHook' _ _ = return (All True) |