diff options
author | Michal Minar <miminar@redhat.com> | 2015-08-02 10:00:21 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2015-08-02 11:14:06 +0200 |
commit | 9a59e55b1b527cdc0b4154a2a7ea022764de421e (patch) | |
tree | 9d2990f1b07e4fb0620adb7aa52e5712cfd38a28 /src/XMonad | |
parent | 71f050e907b5e8e3cf1828090b3cd5bb45dd6a86 (diff) | |
download | xminad-9a59e55b1b527cdc0b4154a2a7ea022764de421e.tar.gz xminad-9a59e55b1b527cdc0b4154a2a7ea022764de421e.tar.xz xminad-9a59e55b1b527cdc0b4154a2a7ea022764de421e.zip |
Moved eventHook to local library
Signed-off-by: Michal Minar <miminar@redhat.com>
Diffstat (limited to 'src/XMonad')
-rw-r--r-- | src/XMonad/Local/EventHook.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/XMonad/Local/EventHook.hs b/src/XMonad/Local/EventHook.hs new file mode 100644 index 0000000..aa26b7e --- /dev/null +++ b/src/XMonad/Local/EventHook.hs @@ -0,0 +1,32 @@ +module XMonad.Local.EventHook (eventHook) where + +import qualified Data.Map as M +import Data.Monoid + +import XMonad +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.FadeWindows +import XMonad.Hooks.ManageDocks +import qualified XMonad.StackSet as W + +eventHook :: Event -> X All +eventHook = mconcat + [ ewmhDesktopsEventHook + , docksEventHook + , fadeWindowsEventHook + , focusFollowsTiledOnly + , fullscreenEventHook + ] + +-- | Enables 'focusFollowsMouse' for tiled windows only. For this to +-- work you need to turn off 'focusFollowsMouse' in your configuration +-- and then add this function to your 'handleEventHook'. +focusFollowsTiledOnly :: Event -> X All +focusFollowsTiledOnly e@(CrossingEvent {ev_window = w, ev_event_type = t}) + | isNormalEnter = whenX bothTiled (focus w) >> mempty + where isNormalEnter = t == enterNotify && ev_mode e == notifyNormal + bothTiled = notFloating w <&&> currentIsTiled + currentIsTiled = currentWindow >>= maybe (return True) notFloating + currentWindow = gets $ W.peek . windowset + notFloating w' = gets $ not . M.member w' . W.floating . windowset +focusFollowsTiledOnly _ = mempty |