aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2010-07-06 20:58:34 +0200
committerTomas Janousek <tomi@nomi.cz>2010-07-06 20:58:34 +0200
commit5ef09d524f956788776dfa5442510b5bc1acbcdd (patch)
tree7cac6073da47eca85a03fa45258bb2771794dcf3 /XMonad
parent45ab6c08dfd51841d4c5d9b8062d27c345416c5e (diff)
downloadXMonadContrib-5ef09d524f956788776dfa5442510b5bc1acbcdd.tar.gz
XMonadContrib-5ef09d524f956788776dfa5442510b5bc1acbcdd.tar.xz
XMonadContrib-5ef09d524f956788776dfa5442510b5bc1acbcdd.zip
X.H.ManageDocks: event hook to refresh on new docks
Ignore-this: 96f931aa19c45acd28bdc2319c6a0cb6 darcs-hash:20100706185834-c9ff5-8f6b33d34eee88122fdb1371703f7924061d2fd9.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Hooks/ManageDocks.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/XMonad/Hooks/ManageDocks.hs b/XMonad/Hooks/ManageDocks.hs
index 5f7577b..6bb6502 100644
--- a/XMonad/Hooks/ManageDocks.hs
+++ b/XMonad/Hooks/ManageDocks.hs
@@ -18,6 +18,7 @@ module XMonad.Hooks.ManageDocks (
-- * Usage
-- $usage
manageDocks, checkDock, AvoidStruts, avoidStruts, avoidStrutsOn,
+ docksEventHook,
ToggleStruts(..),
SetStruts(..),
module XMonad.Util.Types,
@@ -34,6 +35,7 @@ import XMonad.Layout.LayoutModifier
import XMonad.Util.Types
import XMonad.Util.WindowProperties (getProp32s)
import XMonad.Util.XUtils (fi)
+import Data.Monoid (All(..))
import qualified Data.Set as S
@@ -56,6 +58,11 @@ import qualified Data.Set as S
-- > layoutHook = avoidStruts (tall ||| mirror tall ||| ...)
-- > where tall = Tall 1 (3/100) (1/2)
--
+-- The third component is an event hook that causes new docks to appear
+-- immediately, instead of waiting for the next focus change.
+--
+-- > handleEventHook = ... <+> docksEventHook
+--
-- 'AvoidStruts' also supports toggling the dock gaps; add a keybinding
-- similar to:
--
@@ -102,6 +109,14 @@ checkDock = ask >>= \w -> liftX $ do
Just [r] -> return $ elem (fromIntegral r) [dock, desk]
_ -> return False
+-- | Whenever a new dock appears, refresh the layout immediately to avoid the
+-- new dock.
+docksEventHook :: Event -> X All
+docksEventHook (MapNotifyEvent {ev_window = w}) = do
+ whenX ((not `fmap` (isClient w)) <&&> runQuery checkDock w) refresh
+ return (All True)
+docksEventHook _ = return (All True)
+
-- | Gets the STRUT config, if present, in xmonad gap order
getStrut :: Window -> X [Strut]
getStrut w = do