Skip to content

Commit

Permalink
Update window ranking in jumpToActivity to account for WLSquelch
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Aug 15, 2024
1 parent 9b435a9 commit 1e2c699
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Client/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1e2c699

Please sign in to comment.