-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
X.A.WindowNavigation: better handling of floating windows and Full layout #896
Conversation
XMonad/Actions/WindowNavigation.hs
Outdated
-- (keeps the position as-is if it is already inside the target rectangle) | ||
centerPosition :: Rectangle -> Point -> Point | ||
centerPosition (Rectangle rx ry rw rh) pos@(Point x y) = do | ||
if x >= rx && x < rx + fromIntegral rw && y >= ry && y < ry + fromIntegral rh |
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.
We have https://hackage.haskell.org/package/xmonad-0.18.0/docs/XMonad-Operations.html#v:pointWithin, would it be useful here?
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.
Yes, that's useful, I'll update the code.
pos = pointTransform dir currentPos | ||
wr = rectTransform dir currentRect | ||
|
||
rectInside r = (rect_p1 r >= rect_p1 wr && rect_p1 r < rect_p2 wr && rect_p2 r > rect_p1 wr && rect_p2 r <= rect_p2 wr) && |
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.
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 one is less useful, because it doesn't handle the special case of a window that fully overlaps the current window in the orthogonal direction.
…yout Previous version most of the time just got "stuck" on floating windows, switching back and forth between floating window and tiled window underneath. This was because "magic point" was left in the same position and thus next navigation commands selected the same windows over and over again. Now the "magic point" is moved around such that it doesn't overlap with the previously selected window, and there are more complicated rules to make navigation between floating and tiled windows more natural. The original behavior of navigating between tiled windows is preserved almost precisely. Previous version also prevented switching windows using focusUp/focusDown when in Full layout. Now there's a special case that handles such situations.
3f6e585
to
66d334f
Compare
I'm going to wait a few days for one of the other maintainers to look at it, but as they're often unavailable I won't wait too long. |
FWIW I definitely plan to look at this in the coming days |
Thanks! |
Description
Previous version of WindowNavigation just got "stuck" on floating windows, switching back and forth between floating window and tiled window underneath. This was because "magic point" was left in the same position and thus next navigation commands selected the same windows over and over again. Now the "magic point" is moved around such that it doesn't overlap with the previously selected window, and there are more complicated rules to make navigation between floating and tiled windows more natural.
The original behavior of navigating between tiled windows is preserved almost precisely (the tree-like layouts - which should be overwhelmingly the most popular ones - will have exactly the same behavior, the only differences might be in some convoluted custom layouts).
Previous version of WindowNavigation also prevented switching windows using focusUp/focusDown when in Full layout. Now there's a special case that handles such situations.
Checklist
CHANGES.md
file