From b71ef35f1a1a1d62d51a102496b6b73ece81d3d6 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Tue, 30 Mar 2010 16:13:41 +0200 Subject: X.H.UrgencyHook: performance fix Ignore-this: b626166259858f16bc5051c67b498c68 cleanupUrgents would update the Map in extensible state 2-times the number of visible windows, resulting in excessive memory usage and garbage collection. This seems to make it behave correctly. darcs-hash:20100330141341-c9ff5-640ee7327b6818fd5a7560af8296056c9c9f3803.gz --- XMonad/Hooks/UrgencyHook.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'XMonad/Hooks') diff --git a/XMonad/Hooks/UrgencyHook.hs b/XMonad/Hooks/UrgencyHook.hs index 7dcdf18..eb9173c 100644 --- a/XMonad/Hooks/UrgencyHook.hs +++ b/XMonad/Hooks/UrgencyHook.hs @@ -79,7 +79,7 @@ import XMonad.Util.Timer (TimerId, startTimer, handleTimer) import Control.Applicative ((<$>)) import Control.Monad (when) import Data.Bits (testBit) -import Data.List (delete) +import Data.List (delete, (\\)) import Data.Maybe (listToMaybe, maybeToList) import qualified Data.Set as S @@ -372,7 +372,9 @@ shouldSuppress :: SuppressWhen -> Window -> X Bool shouldSuppress sw w = elem w <$> suppressibleWindows sw cleanupUrgents :: SuppressWhen -> X () -cleanupUrgents sw = mapM_ clearUrgency =<< suppressibleWindows sw +cleanupUrgents sw = do + sw' <- suppressibleWindows sw + adjustUrgents (\\ sw') >> adjustReminders (filter $ ((`notElem` sw') . window)) suppressibleWindows :: SuppressWhen -> X [Window] suppressibleWindows Visible = gets $ S.toList . mapped -- cgit v1.2.3