From 1e2c699dd1da0e07f709e989dcc0084897013dce Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Thu, 15 Aug 2024 15:59:54 -0700 Subject: [PATCH] Update window ranking in jumpToActivity to account for WLSquelch --- src/Client/State.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Client/State.hs b/src/Client/State.hs index 3deb1030..f9710a8b 100644 --- a/src/Client/State.hs +++ b/src/Client/State.hs @@ -992,21 +992,24 @@ clientExtraFocuses st = -- considered important and will be jumped to first. jumpToActivity :: ClientState -> ClientState jumpToActivity st = - case locate (Nothing, 1) windowList of + case locate (Nothing, minimumRank) windowList of Just focus -> changeFocus focus st Nothing -> case view clientActivityReturn st of Just focus -> changeFocus focus st Nothing -> st where + minimumRank = (WLBoring, True) -- windows have to be more interesting than this to qualify + maximumRank = (WLImportant, True) -- the most interesting a window can be + windowList = views clientWindows Map.toAscList st locate (v, _) [] = v locate vp@(_, vRank) ((f,w):wins) - | fRank == 5 = Just f -- Short circuit + | fRank == maximumRank = Just f -- Short circuit | fRank > vRank = locate (Just f, fRank) wins | otherwise = locate vp wins where - fRank = fromEnum (isJust $ view winName w) + 2 * fromEnum (view winMention w) + fRank = (view winMention w, views winName isJust w) -- | Jump the focus directly to a window based on its zero-based index -- while ignoring hidden windows.