diff options
author | pastorelli.mario <pastorelli.mario@gmail.com> | 2012-08-16 17:30:32 +0200 |
---|---|---|
committer | pastorelli.mario <pastorelli.mario@gmail.com> | 2012-08-16 17:30:32 +0200 |
commit | 464caa4bd8fa8c71f2dc1928f6a2ec0a5a392f55 (patch) | |
tree | b899d797649380009bd1b0a2ec76ba74c1f6e1ab /XMonad/Hooks | |
parent | cabf7d96ae1026e5f69a106f5cabe4c183c30298 (diff) | |
download | XMonadContrib-464caa4bd8fa8c71f2dc1928f6a2ec0a5a392f55.tar.gz XMonadContrib-464caa4bd8fa8c71f2dc1928f6a2ec0a5a392f55.tar.xz XMonadContrib-464caa4bd8fa8c71f2dc1928f6a2ec0a5a392f55.zip |
ewmh-eventhook-custom
Ignore-this: 95176f6d955d74321c28caafda63faa0
Add ewmhDesktopsEventHookCustom, a generalized version of ewmhDesktopsEventHook that takes a sort function as argument. This sort function should be the same used by the LogHook.
darcs-hash:20120816153032-2383e-19bbca44d0d0b39996c2e46fb2c3ebd9470ce746.gz
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r-- | XMonad/Hooks/EwmhDesktops.hs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/XMonad/Hooks/EwmhDesktops.hs b/XMonad/Hooks/EwmhDesktops.hs index 46490ea..b3bed77 100644 --- a/XMonad/Hooks/EwmhDesktops.hs +++ b/XMonad/Hooks/EwmhDesktops.hs @@ -20,6 +20,7 @@ module XMonad.Hooks.EwmhDesktops ( ewmhDesktopsLogHook, ewmhDesktopsLogHookCustom, ewmhDesktopsEventHook, + ewmhDesktopsEventHookCustom, fullscreenEventHook ) where @@ -117,18 +118,22 @@ ewmhDesktopsLogHookCustom f = withWindowSet $ \s -> do -- * _NET_WM_DESKTOP (move windows to other desktops) -- -- * _NET_ACTIVE_WINDOW (activate another window, changing workspace if needed) --- -ewmhDesktopsEventHook :: Event -> X All -ewmhDesktopsEventHook e = handle e >> return (All True) +ewmhDesktopsEventHook = ewmhDesktopsEventHookCustom id + +-- | +-- Generalized version of ewmhDesktopsEventHook that allows an arbitrary +-- user-specified function to transform the workspace list (post-sorting) +ewmhDesktopsEventHookCustom :: ([WindowSpace] -> [WindowSpace]) -> Event -> X All +ewmhDesktopsEventHookCustom f e = handle f e >> return (All True) -handle :: Event -> X () -handle ClientMessageEvent { +handle :: ([WindowSpace] -> [WindowSpace]) -> Event -> X () +handle f (ClientMessageEvent { ev_window = w, ev_message_type = mt, ev_data = d - } = withWindowSet $ \s -> do + }) = withWindowSet $ \s -> do sort' <- getSortByIndex - let ws = sort' $ W.workspaces s + let ws = f $ sort' $ W.workspaces s a_cd <- getAtom "_NET_CURRENT_DESKTOP" a_d <- getAtom "_NET_WM_DESKTOP" @@ -155,7 +160,7 @@ handle ClientMessageEvent { -- The Message is unknown to us, but that is ok, not all are meant -- to be handled by the window manager return () -handle _ = return () +handle _ _ = return () -- | -- An event hook to handle applications that wish to fullscreen using the |