From 922dfa2cfac8b546c2a6c76421533f102804bb87 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 1 Sep 2012 21:36:27 +0200 Subject: Send hide or reveal signal for toggling This is a more abstract way of implementing the Toggle operation. --- src/Xmobar.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Xmobar.hs b/src/Xmobar.hs index f531cb4..6be0d0c 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -176,7 +176,10 @@ eventLoop tv xc@(XConf d _ w fs cfg) signal = do $ threadDelay t >> atomically (putTMVar signal $ Reveal 0) eventLoop tv xc signal - toggle t = isMapped d w >>= \b -> if b then hide t else reveal t + toggle t = do + ismapped <- isMapped d w + atomically (putTMVar signal $ if ismapped then Hide t else Reveal t) + eventLoop tv xc signal reposWindow rcfg = do r' <- repositionWin d w fs rcfg -- cgit v1.2.3