summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJochen Keil <jochen.keil@gmail.com>2012-09-01 21:40:42 +0200
committerJochen Keil <jochen.keil@gmail.com>2012-09-01 21:40:42 +0200
commit8ccd5aa759175d204dccd0b580a3477ab23747f2 (patch)
treee6146868fd034b8ba12d8a007b455de9ddc22bae
parent6dd88a76c61b2926ad553e50182aa8758ecbb69d (diff)
downloadxmobar-8ccd5aa759175d204dccd0b580a3477ab23747f2.tar.gz
xmobar-8ccd5aa759175d204dccd0b580a3477ab23747f2.tar.bz2
Set StrutValues only if window is actually mapped
For a ChangeScreen or Reposition signal the setProperties function is called which sets the StrutValues regardless of the mapping state. This means that for an unmapped window a window manager will produce an empty gap. Fixing this is easy. Just set the StrutValues to 0.
-rw-r--r--src/Window.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Window.hs b/src/Window.hs
index 9b0c506..7ff1ffe 100644
--- a/src/Window.hs
+++ b/src/Window.hs
@@ -96,8 +96,11 @@ setProperties r c d w srs = do
setTextProperty d w "xmobar" wM_CLASS
setTextProperty d w "xmobar" wM_NAME
- changeProperty32 d w a1 c1 propModeReplace $ map fi $
- getStrutValues r (position c) (getRootWindowHeight srs)
+ ismapped <- isMapped d w
+ changeProperty32 d w a1 c1 propModeReplace $
+ if ismapped
+ then map fi $ getStrutValues r (position c) (getRootWindowHeight srs)
+ else replicate 12 0
changeProperty32 d w a2 c2 propModeReplace [fromIntegral v]
getProcessID >>= changeProperty32 d w p c1 propModeReplace . return . fromIntegral