summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-08-22 22:42:01 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-08-22 22:42:01 +0200
commite7cadcd8dee8c2e79e338f67cb27b675aba6bac5 (patch)
treec0c470e5a0f19b6d53e6772b079197442bb9bf57 /src/Xmobar.hs
parent8e87d8671c06eb5acca3a4c92e569e1dba253160 (diff)
parenta05c57f7aed141a8d6dc9038be177712be432b9d (diff)
downloadxmobar-e7cadcd8dee8c2e79e338f67cb27b675aba6bac5.tar.gz
xmobar-e7cadcd8dee8c2e79e338f67cb27b675aba6bac5.tar.bz2
Merge remote-tracking branch 'jrk/dbusstuff' into jrk
Diffstat (limited to 'src/Xmobar.hs')
-rw-r--r--src/Xmobar.hs25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 79234d2..f531cb4 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -146,9 +146,9 @@ eventLoop tv xc@(XConf d _ w fs cfg) signal = do
ncfg <- updateConfigPosition cfg
reposWindow ncfg
- Hide -> hide
- Reveal -> reveal
- Toggle -> toggle
+ Hide t -> hide (t*100*1000)
+ Reveal t -> reveal (t*100*1000)
+ Toggle t -> toggle (t*100*1000)
TogglePersistent -> eventLoop
tv xc { config = cfg { persistent = not $ persistent cfg } } signal
@@ -156,16 +156,27 @@ eventLoop tv xc@(XConf d _ w fs cfg) signal = do
where
isPersistent = not $ persistent cfg
- hide = when isPersistent (hideWindow d w) >> eventLoop tv xc signal
+ hide t | t == 0 = do
+ when isPersistent $ hideWindow d w
+ eventLoop tv xc signal
+ | otherwise = do
+ void $ forkIO
+ $ threadDelay t >> atomically (putTMVar signal $ Hide 0)
+ eventLoop tv xc signal
- reveal = if isPersistent
- then do
+ reveal t | t == 0 =
+ if isPersistent
+ then do
r' <- repositionWin d w fs cfg
showWindow d w
eventLoop tv (XConf d r' w fs cfg) signal
else eventLoop tv xc signal
+ | otherwise = do
+ void $ forkIO
+ $ threadDelay t >> atomically (putTMVar signal $ Reveal 0)
+ eventLoop tv xc signal
- toggle = isMapped d w >>= \b -> if b then hide else reveal
+ toggle t = isMapped d w >>= \b -> if b then hide t else reveal t
reposWindow rcfg = do
r' <- repositionWin d w fs rcfg