mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-04 22:21:56 -07:00
Make focus-follows-mouse configurable
This commit is contained in:
@@ -26,10 +26,12 @@ module XMonad.Config (defaultConfig) where
|
|||||||
--
|
--
|
||||||
import XMonad.Core as XMonad hiding
|
import XMonad.Core as XMonad hiding
|
||||||
(workspaces,manageHook,numlockMask,keys,logHook,borderWidth,mouseBindings
|
(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
|
import qualified XMonad.Core as XMonad
|
||||||
(workspaces,manageHook,numlockMask,keys,logHook,borderWidth,mouseBindings
|
(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.Layout
|
||||||
import XMonad.Operations
|
import XMonad.Operations
|
||||||
@@ -165,6 +167,10 @@ layout = tiled ||| Mirror tiled ||| Full
|
|||||||
terminal :: String
|
terminal :: String
|
||||||
terminal = "xterm"
|
terminal = "xterm"
|
||||||
|
|
||||||
|
-- | Whether focus follows the mouse pointer.
|
||||||
|
focusFollowsMouse :: Bool
|
||||||
|
focusFollowsMouse = True
|
||||||
|
|
||||||
-- | The xmonad key bindings. Add, modify or remove key bindings here.
|
-- | The xmonad key bindings. Add, modify or remove key bindings here.
|
||||||
--
|
--
|
||||||
-- (The comment formatting character is used when generating the manpage)
|
-- (The comment formatting character is used when generating the manpage)
|
||||||
@@ -251,4 +257,5 @@ defaultConfig = XConfig
|
|||||||
, XMonad.keys = keys
|
, XMonad.keys = keys
|
||||||
, XMonad.logHook = logHook
|
, XMonad.logHook = logHook
|
||||||
, XMonad.mouseBindings = mouseBindings
|
, XMonad.mouseBindings = mouseBindings
|
||||||
, XMonad.manageHook = manageHook }
|
, XMonad.manageHook = manageHook
|
||||||
|
, XMonad.focusFollowsMouse = focusFollowsMouse }
|
||||||
|
@@ -88,6 +88,7 @@ data XConfig l = XConfig
|
|||||||
-- ^ The mouse bindings
|
-- ^ The mouse bindings
|
||||||
, borderWidth :: !Dimension -- ^ The border width
|
, borderWidth :: !Dimension -- ^ The border width
|
||||||
, logHook :: !(X ()) -- ^ The action to perform when the windows set is changed
|
, logHook :: !(X ()) -- ^ The action to perform when the windows set is changed
|
||||||
|
, focusFollowsMouse :: !Bool -- ^ Whether window entry events can change focus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -194,7 +194,8 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b })
|
|||||||
-- entered a normal window, makes this focused.
|
-- entered a normal window, makes this focused.
|
||||||
handle e@(CrossingEvent {ev_window = w, ev_event_type = t})
|
handle e@(CrossingEvent {ev_window = w, ev_event_type = t})
|
||||||
| t == enterNotify && ev_mode e == notifyNormal
|
| 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
|
-- left a window, check if we need to focus root
|
||||||
handle e@(CrossingEvent {ev_event_type = t})
|
handle e@(CrossingEvent {ev_event_type = t})
|
||||||
|
Reference in New Issue
Block a user