-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
add snapping to floating windows #8088
Conversation
3f26ef3
to
f59c049
Compare
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.
neat feat
63a2149
to
c6597a0
Compare
Works for both moving and resizing of windows. It comes with 3 options: `general:snap:enabled` - whether it's enabled, off by default `general:snap:window_gap` - minimum gap in pixels between windows before snapping. Setting to 0 effectively turns off this method of snapping. `general:snap:monitor_gap` - minimum gap in pixels between window and monitor edges before snapping. Again, setting it to 0 effectively turns it off.
The approach of performing corner snaps after each individual edge snap results in far fewer scenarios where snapping can occur. After trying it out for a while, I found that I prefer an approach that's more prone to snapping.
tag me for review when ready |
@vaxerski ready for review. EDIT: Sorry, one more change incoming. I've been working under the assumption that all windows share the same border size |
- add new line between functions - use std::function typedef for SnapFn and make snap functions static - avoid uninitialized variable declarations. - change ignore condition m_bIsX11 to isX11OverrideRedirect() - use braces for CBox and Vector2D declarations. - add SNAP_INVALID to eSnapEdge enum - use bitshift notation for eSnapEdge and eRectCorner - make performSnap a non-member function.
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.
lgtm, wiki mr needed
Describe your PR, what does it fix/add?
While moving and resizing floating windows, edges and corners will snap to the edges/corners of the monitor or other windows when they get close enough to each other.
It started as an update to @shadowmax31 's PR #3236 , but was eventually changed to behave more similarly to KWin's snapping feature.
It comes with 3 options:
general:snap:enabled
- whether it's enabled, off by defaultgeneral:snap:window_gap
- minimum gap in pixels between windows before snapping. Setting to 0 effectively turns off this method of snapping.general:snap:monitor_gap
- minimum gap in pixels between window and monitor edges before snapping. Again, setting it to 0 effectively turns it off.Here's a video of it with these settings:
2024-10-11.18-28-50.mp4
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
Not that I can think of.
Is it ready for merging, or does it need work?
Ready to merge.