Skip to content
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 CascadeActiveAppWindows refinements #1431

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

rudifa
Copy link
Contributor

@rudifa rudifa commented Jul 27, 2024

This PR proposes refinements to the command cascadeActiveApp (published in rectangle v0.69 from PR #1146 and #1163)

  • before: the cascade goes to the top left quadrant

  • now: the cascade goes to the quadrant in which the center of the active window is found, so that the user can have up to 4 different apps cascaded

  • before: the size of the active (first) window is enforced onto the other windows in the cascade

  • now: same, but the size width and height are constrained so that all cascaded windows remain within the screen

- the cascade goes to the quadrant in which the center of the active window is found
- width and height of the cascaded windows are limited so that they remain within the screen
@rudifa
Copy link
Contributor Author

rudifa commented Jul 27, 2024

Example screenshot:

Screenshot 2024-07-27 at 20 58 50

@rxhanson
Copy link
Owner

Thanks for continuing to improve your work here! I understand the changes you're making, and this corner of the code is mainly only touched by you, but if you don't mind let's make the names of everything more readable. I'll comment inline.

Rectangle/MultiWindow/MultiWindowManager.swift Outdated Show resolved Hide resolved
bottom = windowFrame.midY > screenFrame.midY
self.n = n
let m = CGSize(width: screenFrame.width - CGFloat(n - 1) * delta, height: screenFrame.height - CGFloat(n - 1) * delta)
self.size = CGSize(width: min(size.width, m.width), height: min(size.height, m.height))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n and m here take some reasoning to figure out what they mean. Can you think of better names for them?

filtered.removeFirst()
filtered.append(first)
firstSize = first.size
caaw = CascadeActiveAppWindows(windowFrame: first.frame, screenFrame: screenFrame, n: filtered.count, size: first.size!, delta: delta)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CascadeActiveAppWindows becomes CascadeActiveAppParameters, then we could change caaw to something like cascadeParameters

@rudifa
Copy link
Contributor Author

rudifa commented Jul 28, 2024

@rxhanson Thank you for the suggestions to make the code more readable, which I now applied.

@rxhanson rxhanson merged commit e0caa3d into rxhanson:main Jul 29, 2024
1 check passed
@rxhanson
Copy link
Owner

Looks good!

@rudifa
Copy link
Contributor Author

rudifa commented Jul 29, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants