rxhanson / Rectangle

Move and resize windows on macOS with keyboard shortcuts and snap areas
https://rectangleapp.com
Other
25.91k stars 778 forks source link

Added support for corner sixth snap areas #799

Closed davystrong closed 2 years ago

davystrong commented 2 years ago

Added support for snapping to corner sixths, as I like sixths for a wide screen but don't like keyboard shortcuts. I used similar logic to the two thirds snap areas, but starting from the corner and dragging inwards, to the thirds position, and the equivalent at the top. I couldn't work out what topLeftShort, etc. meant and my logic works with and without the dock. Let me know if I need to add some logic to deal with "short" options. I didn't add any region for centre sixths, as I can't think of any good gestures. I also didn't add the logic for portrait mode. Would this be useful? I don't think I have any way to actually test this.

rxhanson commented 2 years ago

Thanks for contributing. This looks good, but at first cut it should all go behind a feature flag, configurable behind a terminal command. To do this, you can just create another entry in the Defaults class, and you might as well make it an OptionalBoolDefault which allows it to be easily enabled in the code in a future release if desired. Then in the code you would just check if the default is userEnabled. If this is confusing just let me know and I can clarify or just merge your pr and add it. I think this is a good improvement, but don't want to spring it on users suddenly.

topLeftShort and corresponding snap areas are the top half / bottom half areas on the left & right edges near the corners. If you drag the window up the left side of the screen then you'll see it change to top half before top left corner.

That's fine to go without portrait mode equivalents at this time, especially since it's initially rolled out via feature flag.

davystrong commented 2 years ago

Hi @rxhanson, thanks for that explanation, I've added it as you suggested.

rxhanson commented 2 years ago

Thanks! I'm planning on rolling out a release pretty soon.