blob: aa26b7e512e09b9b0fc5aa602088a31d2ca846d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|