summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar.hs
diff options
context:
space:
mode:
authorJochen Keil <jochen.keil@gmail.com>2012-09-01 21:51:54 +0200
committerJochen Keil <jochen.keil@gmail.com>2012-09-01 21:51:54 +0200
commit4d0504dfe6f6ad4a3ddd39e046a54864e6a306bc (patch)
tree19f43396059f8b8ceb062bfcc468b3abf4696331 /src/Xmobar.hs
parent2b27a08668461ab83c2a4d2c084ed7ae18c965b0 (diff)
downloadxmobar-4d0504dfe6f6ad4a3ddd39e046a54864e6a306bc.tar.gz
xmobar-4d0504dfe6f6ad4a3ddd39e046a54864e6a306bc.tar.bz2
Some cosmetic fixes.
I tried to scrap the hide/reveal boilerplate, but that didn't work out due different functions ({show,hide}Window) and signaltypes. Got almost as ugly. Maybe a pattern matching function instead of the "case typ of" would be nicer. But that's just code golfing.
Diffstat (limited to 'src/Xmobar.hs')
-rw-r--r--src/Xmobar.hs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index d2d29ad..9bec6bc 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -156,24 +156,22 @@ eventLoop tv xc@(XConf d r w fs cfg) signal = do
where
isPersistent = not $ persistent cfg
- 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
+ hide t
+ | t == 0 =
+ 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 t | t == 0 =
- if isPersistent
- then do
- showWindow r cfg d w
+ reveal t
+ | t == 0 = do
+ when isPersistent (showWindow r cfg d w)
+ eventLoop tv xc signal
+ | otherwise = do
+ void $ forkIO
+ $ threadDelay t >> atomically (putTMVar signal $ Reveal 0)
eventLoop tv xc signal
- else eventLoop tv xc signal
- | otherwise = do
- void $ forkIO
- $ threadDelay t >> atomically (putTMVar signal $ Reveal 0)
- eventLoop tv xc signal
toggle t = do
ismapped <- isMapped d w