summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar.hs
diff options
context:
space:
mode:
authorJochen Keil <jochen.keil@gmail.com>2012-08-08 20:30:40 +0200
committerJochen Keil <jochen.keil@gmail.com>2012-08-09 10:46:19 +0200
commitcc77b5a7bc8309f694fd0aed4110b92f16316c0b (patch)
tree99540111d9c08eda6c3e8950073534c27cba2c0c /src/Xmobar.hs
parentfa4b999c73067cb55e316b94fe62aebb147cea98 (diff)
downloadxmobar-cc77b5a7bc8309f694fd0aed4110b92f16316c0b.tar.gz
xmobar-cc77b5a7bc8309f694fd0aed4110b92f16316c0b.tar.bz2
Add functions for {reveal,hid,toggl}ing the window
Toggling is based is based on the current window status. If unmapped then reveal else hide. Sync is necessary or delays might occur. The functions are called from the event loop when the according signal is received When mapping (revealing) the window again we need to set the struts property again. The easiest way to do this is to call repositionWin. However, repositionWin needs access to the Config structure which is available in eventLoop. Because decomposition wouldn't be easy and I don't want to pass Config down to showWindow (which would need to return the new Rectangle then) this is done here.
Diffstat (limited to 'src/Xmobar.hs')
-rw-r--r--src/Xmobar.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 1b58352..a65a236 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -140,7 +140,18 @@ eventLoop tv xc@(XConf d _ w fs cfg) signal = do
ncfg <- updateConfigPosition cfg
reposWindow ncfg
+ Hide -> hide
+ Reveal -> reveal
+ Toggle -> toggle
+
where
+ hide = hideWindow d w >> eventLoop tv xc signal
+ reveal = do
+ r' <- repositionWin d w fs cfg
+ showWindow d w
+ eventLoop tv (XConf d r' w fs cfg) signal
+ toggle = isMapped d w >>= \b -> if b then hide else reveal
+
reposWindow rcfg = do
r' <- repositionWin d w fs rcfg
eventLoop tv (XConf d r' w fs rcfg) signal