diff options
author | Daniel Schoepe <asgaroth_@gmx.de> | 2009-02-03 17:00:46 +0100 |
---|---|---|
committer | Daniel Schoepe <asgaroth_@gmx.de> | 2009-02-03 17:00:46 +0100 |
commit | 43e952a307c22f7098963061f7f6127974158c13 (patch) | |
tree | adeef00961b45644558d6068522e77b36f0b2ff9 /XMonad/Hooks/UrgencyHook.hs | |
parent | a76661c77c488d648dfdae72b2b8ab98d72c338d (diff) | |
download | XMonadContrib-43e952a307c22f7098963061f7f6127974158c13.tar.gz XMonadContrib-43e952a307c22f7098963061f7f6127974158c13.tar.xz XMonadContrib-43e952a307c22f7098963061f7f6127974158c13.zip |
Adjustments to use the new event hook feature instead of Hooks.EventHook
Ignore-this: f8c239bc8e301cbd6fa509ef748af542
darcs-hash:20090203160046-cb1c6-d66821c5b8a5a60e3b76148654c6e28806b37749.gz
Diffstat (limited to 'XMonad/Hooks/UrgencyHook.hs')
-rw-r--r-- | XMonad/Hooks/UrgencyHook.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/XMonad/Hooks/UrgencyHook.hs b/XMonad/Hooks/UrgencyHook.hs index b41285e..79b171c 100644 --- a/XMonad/Hooks/UrgencyHook.hs +++ b/XMonad/Hooks/UrgencyHook.hs @@ -70,7 +70,6 @@ module XMonad.Hooks.UrgencyHook ( import XMonad import qualified XMonad.StackSet as W -import XMonad.Hooks.EventHook import XMonad.Util.Dzen (dzenWithArgs, seconds) import XMonad.Util.NamedWindows (getName) import XMonad.Util.Timer (TimerId, startTimer, handleTimer) @@ -199,7 +198,7 @@ import Foreign (unsafePerformIO) -- 'urgencyConfig' to control behavior. To change this, use 'withUrgencyHook' -- instead. withUrgencyHook :: (LayoutClass l Window, UrgencyHook h) => - h -> XConfig l -> XConfig (HandleEvent (WithUrgencyHook h) l) + h -> XConfig l -> XConfig l withUrgencyHook hook conf = withUrgencyHookC hook urgencyConfig conf -- | This lets you modify the defaults set in 'urgencyConfig'. An example: @@ -208,9 +207,9 @@ withUrgencyHook hook conf = withUrgencyHookC hook urgencyConfig conf -- -- (Don't type the @...@, you dolt.) See 'UrgencyConfig' for details on configuration. withUrgencyHookC :: (LayoutClass l Window, UrgencyHook h) => - h -> UrgencyConfig -> XConfig l -> XConfig (HandleEvent (WithUrgencyHook h) l) + h -> UrgencyConfig -> XConfig l -> XConfig l withUrgencyHookC hook urgConf conf = conf { - layoutHook = eventHook (WithUrgencyHook hook urgConf) $ layoutHook conf, + handleEventHook = \e -> handleEvent (WithUrgencyHook hook urgConf) e >> handleEventHook conf e, logHook = cleanupUrgents (suppressWhen urgConf) >> logHook conf } @@ -322,9 +321,10 @@ data WithUrgencyHook h = WithUrgencyHook h UrgencyConfig -- ourselves, allowing us to clear urgency when a window is visible, and not to -- set urgency if a window is visible. If you have a better idea, please, let us -- know! -instance UrgencyHook h => EventHook (WithUrgencyHook h) where - handleEvent wuh event = case event of - PropertyEvent { ev_event_type = t, ev_atom = a, ev_window = w } -> do +handleEvent :: UrgencyHook h => WithUrgencyHook h -> Event -> X () +handleEvent wuh event = + case event of + PropertyEvent { ev_event_type = t, ev_atom = a, ev_window = w } -> do when (t == propertyNotify && a == wM_HINTS) $ withDisplay $ \dpy -> do WMHints { wmh_flags = flags } <- io $ getWMHints dpy w if (testBit flags urgencyHintBit) then do @@ -333,9 +333,9 @@ instance UrgencyHook h => EventHook (WithUrgencyHook h) where else clearUrgency w userCodeDef () =<< asks (logHook . config) -- call *after* IORef has been modified - DestroyWindowEvent {ev_window = w} -> + DestroyWindowEvent {ev_window = w} -> clearUrgency w - _ -> + _ -> mapM_ handleReminder =<< readReminders where handleReminder reminder = handleTimer (timer reminder) event $ reminderHook wuh reminder |