From b5738a4792ea94f0f754aae4137d87ddc2a0f077 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 22 Apr 2020 11:34:55 -0600 Subject: Change how clicking works. Allow click through on focus and change focus to current window when pressing the mouse macro buttons. --- src/Internal/Keys.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/Internal/Keys.hs') diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 75a1de9..19ff5b5 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -1,6 +1,8 @@ {-# LANGUAGE RankNTypes #-} module Internal.Keys where +import System.Process +import XMonad.Util.Ungrab import Internal.XPlus import Data.Maybe (isJust) import Debug.Trace @@ -54,6 +56,12 @@ newMouse markContext = , ((modm, 9), const (relativeWorkspaceShift next)) ] +click :: X () +click = do + (dpy, root) <- asks $ (,) <$> display <*> theRoot + (_, _, window, _, _, _, _, _) <- io $ queryPointer dpy root + focus window + newKeys :: MarkContext -> IO (KeyMap l) newKeys markContext = return $ \config@(XConfig {modMask = modm}) -> @@ -118,9 +126,9 @@ newKeys markContext = , ((modm .|. mod1Mask, xK_e), runXPlus markContext config (withScreen W.greedyView 2)) -- Buttons programmed on my mouse. - , ((shiftMask, xK_F1), withFocused $ windows . W.sink) - , ((shiftMask, xK_F2), sendMessage ToggleZoom) - , ((shiftMask, xK_F3), kill) + , ((shiftMask, xK_F1), click >> (withFocused $ windows . W.sink)) + , ((shiftMask, xK_F2), click >> sendMessage ToggleZoom) + , ((shiftMask, xK_F3), click >> kill) ] mapNumbersAndAlpha :: KeyMask -> (Char -> X ()) -> Map (KeyMask, KeySym) (X ()) -- cgit