Improve focus history handling. #898
Merged
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.
Previously, when moving a window from e.g. workspace 1 to workspace 3 by moving it down twice, workspace 2 would end up with the wrong focused window. This was because the window was first moved there (receiving focus), and then removed from that workspace (setting the focus to an adjacent window). However, I could have had any window focused before.
With these changes, the focus will be preserved for in-between workspaces when moving windows.
More generally, when closing a window, it will try to focus the previously closed window instead of just the adjacent ones. The split layout is a special case that still always uses the adjacent windows. Previously this was done sometimes, but not consistently, by using the
insertedMsWindow
andprecedentIndex
fields. But they didn't always work, or they contained bad info. The new approach is more robust.I've also fixed a few bugs that could lead to the task bar tabs getting incorrect states.


In the above screenshot, the launcher tab is highlighted as active, even though Alacritty is the focused application.
or
In the above screenshot, the application launcher is active, but the task bar says Alacritty should be active.
Tested on Gnome 42.4