summaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Config.hs13
-rw-r--r--XMonad/Core.hs1
-rw-r--r--XMonad/Main.hs3
3 files changed, 13 insertions, 4 deletions
diff --git a/XMonad/Config.hs b/XMonad/Config.hs
index 2506be6..677248d 100644
--- a/XMonad/Config.hs
+++ b/XMonad/Config.hs
@@ -26,10 +26,12 @@ module XMonad.Config (defaultConfig) where
--
import XMonad.Core as XMonad hiding
(workspaces,manageHook,numlockMask,keys,logHook,borderWidth,mouseBindings
- ,defaultGaps,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor)
+ ,defaultGaps,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor
+ ,focusFollowsMouse)
import qualified XMonad.Core as XMonad
(workspaces,manageHook,numlockMask,keys,logHook,borderWidth,mouseBindings
- ,defaultGaps,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor)
+ ,defaultGaps,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor
+ ,focusFollowsMouse)
import XMonad.Layout
import XMonad.Operations
@@ -165,6 +167,10 @@ layout = tiled ||| Mirror tiled ||| Full
terminal :: String
terminal = "xterm"
+-- | Whether focus follows the mouse pointer.
+focusFollowsMouse :: Bool
+focusFollowsMouse = True
+
-- | The xmonad key bindings. Add, modify or remove key bindings here.
--
-- (The comment formatting character is used when generating the manpage)
@@ -251,4 +257,5 @@ defaultConfig = XConfig
, XMonad.keys = keys
, XMonad.logHook = logHook
, XMonad.mouseBindings = mouseBindings
- , XMonad.manageHook = manageHook }
+ , XMonad.manageHook = manageHook
+ , XMonad.focusFollowsMouse = focusFollowsMouse }
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index 3b97ed3..9252b05 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -88,6 +88,7 @@ data XConfig l = XConfig
-- ^ The mouse bindings
, borderWidth :: !Dimension -- ^ The border width
, logHook :: !(X ()) -- ^ The action to perform when the windows set is changed
+ , focusFollowsMouse :: !Bool -- ^ Whether window entry events can change focus
}
diff --git a/XMonad/Main.hs b/XMonad/Main.hs
index 31dad6a..94a8a22 100644
--- a/XMonad/Main.hs
+++ b/XMonad/Main.hs
@@ -194,7 +194,8 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b })
-- entered a normal window, makes this focused.
handle e@(CrossingEvent {ev_window = w, ev_event_type = t})
| t == enterNotify && ev_mode e == notifyNormal
- && ev_detail e /= notifyInferior = focus w
+ && ev_detail e /= notifyInferior
+ = whenX (asks $ focusFollowsMouse . config) (focus w)
-- left a window, check if we need to focus root
handle e@(CrossingEvent {ev_event_type = t})