Recency heuristic for ambiguous output selection#3952
Open
ccjmne wants to merge 2 commits into
Open
Conversation
Change the algorithm to determine which output to target when going up, down, left or right. Just like before, the candidate outputs are: - in the correct direction, and - they are at least partially in the (virtually) infinite "strip" obtained from extending the active output either vertically, for up and down motions, or horizontally for horizontal movements. Unlike before, we now rank the candidate outputs by their nearbymost vertical (or horizontal) edge: this allows us to more reasonably end up with ties, where the ambiguity that is natural to the human user also becomes effective in the code. We curate a stack of the most recently used monitors and use it to resolve the ties against the candidates that share the closest edge to the currently active output. If none of the candidates were ever visited, we fall back to the previous heuristic, which would find the closest candidate, according to the distance between their geometric centre and that of the active output. Ref: niri-wm#2897
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discussed in: #2897
This Pull Request changes the algorithm to determine which output to target when going up, down, left or right: it implements some MRU heuristic for all the commands that have to do with choosing an output up, down, left or right.
I also considered making it opt-in, with, say:
But there are so many such functions; at least all of these, in 4 directions:
And I figured people would generally want to have a single selection scheme for all their output selection commands. In any case, we can discuss this and think about it some more, but I think there's something pretty usable here as is it.
Just like before, the candidate outputs are:
obtained from extending the active output either vertically, for up
and down motions, or horizontally for horizontal movements.
Unlike before, we now rank the candidate outputs by their nearbymost
vertical (or horizontal) edge: this allows us to more reasonably end up
with ties, where the ambiguity that is natural to the human user also
becomes effective in the code.
We curate a stack of the most recently used monitors and use it to
resolve the ties against the candidates that share the closest edge to
the currently active output.
If none of the candidates were ever visited, we fall back to the
previous heuristic, which would find the closest candidate, according
to the distance between their geometric centre and that of the active
output.