-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix navigation calculations and focus handling #1187
base: master
Are you sure you want to change the base?
Conversation
Focus left/right direction should handle workspace switching first rather than switching output, in some cases navigating from workspace 3 -> 2 will result in switching monitors Signed-off-by: Dusan <[email protected]>
We need to error like this since saturating sub does nothing on 0usize Signed-off-by: Dusan <[email protected]>
Signed-off-by: Dusan <[email protected]>
Some(direction), | ||
true, | ||
) | ||
match direction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behaviour makes the most sense to me, we should go to previous or next workspace (depending on direction). Those actions also fall back to SwitchOutput if corresponding functions return InvalidWorkspaceIndex
.saturating_sub(1); | ||
let workspace = shell.workspaces.active_num(¤t_output).1; | ||
|
||
if workspace == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here as workspace is of type usize
where 0usize.saturating_sub(1) results in 0
which isn't an invalid index. This is here to allow PreviousWorkspace action to fallback to SwitchOutput on error.
@@ -1723,12 +1723,12 @@ impl Shell { | |||
let geo = o.geometry(); | |||
match direction { | |||
Direction::Left | Direction::Right => { | |||
!(geo.loc.y + geo.size.h < current_output_geo.loc.y | |||
|| geo.loc.y > current_output_geo.loc.y + current_output_geo.size.h) | |||
geo.loc.y < current_output_geo.loc.y + current_output_geo.size.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flipping the logic around helped avoid the issue where SwitchOutput to left resulted in output switch where it shouldn't as my external monitor is above my laptop regarding display.
Thanks for looking into this. I'll take a closer look at the code once working on #1005 (very soon), which also revises shortcuts around output and workspace switching. Given that will likely conflict a bit, I'll most likely cherry-pick parts of this PR. |
I encountered with multi monitor setup.
If I have my laptop display and external display like this
![image](https://private-user-images.githubusercontent.com/5598427/408194000-d18d8b91-04be-4d53-9c56-6288d8b66797.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzYwMDAsIm5iZiI6MTczODkzNTcwMCwicGF0aCI6Ii81NTk4NDI3LzQwODE5NDAwMC1kMThkOGI5MS0wNGJlLTRkNTMtOWM1Ni02Mjg4ZDhiNjY3OTcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTM0MTQwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGJiZDhjOTRlZDg2YjUwOGE2MmY4Yzk5ZGQzMTM4YzYyMDhlZTQxNmMxZjQxNGQ1NzAzZWFiYWZhM2E5NzY5ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.L7qOpDFvgB0dilyfl9mVTqwUy7PG_MabLH1M8svf7BU)
focusing to left direction did not work.
This PR also handles the case where monitors are next to each other, where left direction focusing also didn't work.
I used this JS script to test overlap logic