diff options
author | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-12-29 03:33:01 +0100 |
---|---|---|
committer | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-12-29 03:33:01 +0100 |
commit | c6eae4cb51073cfec1fde1bd6bd8f28a131a2ab4 (patch) | |
tree | 89443e7edadcff927011955a9568ec4bb515a717 /XMonad | |
parent | 8e52f7e22c28300dccf283baa1c19076d390c5b8 (diff) | |
download | metatile-c6eae4cb51073cfec1fde1bd6bd8f28a131a2ab4.tar metatile-c6eae4cb51073cfec1fde1bd6bd8f28a131a2ab4.zip |
Make focus-follows-mouse configurable
darcs-hash:20071229023301-a5988-7576eb2625061b2dcca3da69d1be4a1e50a76e71
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Config.hs | 13 | ||||
-rw-r--r-- | XMonad/Core.hs | 1 | ||||
-rw-r--r-- | XMonad/Main.hs | 3 |
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}) |