From b286c60f3c46209e61cdb5c46c5c35e2e4ad8ddb Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 15 Nov 2021 16:48:28 -0700 Subject: Change marking to use greedy viewing. --- src/Internal/Marking.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Internal/Marking.hs') diff --git a/src/Internal/Marking.hs b/src/Internal/Marking.hs index fc1c082..c1234ec 100644 --- a/src/Internal/Marking.hs +++ b/src/Internal/Marking.hs @@ -1,7 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} module Internal.Marking where -import Internal.Windows (mapWindows) +import Internal.Windows (mapWindows, findWindow, getLocationWorkspace) import XMonad import XMonad.StackSet hiding (focus) import Data.IORef @@ -30,6 +30,13 @@ data MarkState = instance ExtensionClass MarkState where initialValue = MarkState Map.empty Nothing +greedyFocus :: Window -> X () +greedyFocus win = do + ws <- withWindowSet $ \ss -> + return $ getLocationWorkspace =<< findWindow ss win + mapM_ (windows . greedyView . tag) ws + focus win + markCurrentWindow :: Mark -> X () markCurrentWindow mark = do withFocused $ \win -> @@ -47,7 +54,7 @@ jumpToLast :: X () jumpToLast = do m <- markLast <$> XS.get saveLastMark - mapM_ focus m + mapM_ greedyFocus m jumpToMark :: Mark -> X () jumpToMark mark = do @@ -56,7 +63,7 @@ jumpToMark mark = do Nothing -> return () Just w -> do saveLastMark - focus w + greedyFocus w setFocusedWindow :: a -> StackSet i l a s sd -> StackSet i l a s sd setFocusedWindow -- cgit