Change type of X.A.ShowText.handleTimerEvent so example code typechecks.

This commit is contained in:
Adam Vogt 2012-12-26 01:38:41 +00:00
parent 42443e3df2
commit b8a22c4dee

View File

@ -23,6 +23,7 @@ module XMonad.Actions.ShowText
import Control.Monad (when) import Control.Monad (when)
import Data.Map (Map,empty,insert,lookup) import Data.Map (Map,empty,insert,lookup)
import Data.Monoid (mempty, All)
import Prelude hiding (lookup) import Prelude hiding (lookup)
import XMonad import XMonad
import XMonad.StackSet (current,screen) import XMonad.StackSet (current,screen)
@ -78,13 +79,14 @@ defaultSTConfig =
} }
-- | Handles timer events that notify when a window should be removed -- | Handles timer events that notify when a window should be removed
handleTimerEvent :: Event -> X () handleTimerEvent :: Event -> X All
handleTimerEvent (ClientMessageEvent _ _ _ dis _ mtyp d) = do handleTimerEvent (ClientMessageEvent _ _ _ dis _ mtyp d) = do
(ShowText m) <- ES.get :: X ShowText (ShowText m) <- ES.get :: X ShowText
a <- io $ internAtom dis "XMONAD_TIMER" False a <- io $ internAtom dis "XMONAD_TIMER" False
when (mtyp == a && length d >= 1) when (mtyp == a && length d >= 1)
(whenJust (lookup (fromIntegral $ d !! 0) m) deleteWindow) (whenJust (lookup (fromIntegral $ d !! 0) m) deleteWindow)
handleTimerEvent _ = return () mempty
handleTimerEvent _ = mempty
-- | Shows a window in the center of the screen with the given text -- | Shows a window in the center of the screen with the given text
flashText :: ShowTextConfig flashText :: ShowTextConfig