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

Move Window to next Monitor/Maximize/Almost Maximize #7

Open
shaqaruden opened this issue Nov 30, 2023 · 5 comments
Open

Move Window to next Monitor/Maximize/Almost Maximize #7

shaqaruden opened this issue Nov 30, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@shaqaruden
Copy link

I just wanted to reach out and say I almost have moving a window to the next monitor working. I have the window moving to the next monitor but need to fix the positioning and then write previous monitor.

I have also added Maximize and Almost Maximize.

I will submit a pull request when I am finished.

@shaqaruden
Copy link
Author

@thesobercoder I actually have a question. If the next monitor is not the same orientation how should sizing the window work and where should it be positioned? Currently I have it maintaining the same top and left position and will have it resize the window if it does not fit within the window.

@thesobercoder
Copy link
Owner

@shaqaruden Thanks so much for helping me out with this. To answer your question, it is actually a tricky one because we have to consider two things -

  • The next monitor can be smaller than the current one (this can be tackled easily by always calculating the size in ratio of the monitor size)
  • The next monitor can be, as you mentioned, in a different orientation.

The way I think Rectangle does it, is by first calculating the size of the window (again in ratio of the destination monitor) and then place it in equal distance from both top/bottom and left/right. I think that should give us the desired effect. I'm open to other ideas. Let's keep chatting.

@shaqaruden
Copy link
Author

shaqaruden commented Nov 30, 2023

@shaqaruden Thanks so much for helping me out with this. To answer your question, it is actually a tricky one because we have to consider two things -

* The next monitor can be smaller than the current one (this can be tackled easily by always calculating the size in ratio of the monitor size)

* The next monitor can be, as you mentioned, in a different orientation.

The way I think Rectangle does it, is by first calculating the size of the window (again in ratio of the destination monitor) and then place it in equal distance from both top/bottom and left/right. I think that should give us the desired effect. I'm open to other ideas. Let's keep chatting.

So if I understand you correctly, lets say I place a window in the last fourth of a monitor then move it to another monitor it should maintain its relative position of the last fourth?

@shaqaruden
Copy link
Author

I'm going to create the PR now with what I have but leave it in a WIP state

@thesobercoder
Copy link
Owner

@shaqaruden Thanks so much for helping me out with this. To answer your question, it is actually a tricky one because we have to consider two things -

* The next monitor can be smaller than the current one (this can be tackled easily by always calculating the size in ratio of the monitor size)

* The next monitor can be, as you mentioned, in a different orientation.

The way I think Rectangle does it, is by first calculating the size of the window (again in ratio of the destination monitor) and then place it in equal distance from both top/bottom and left/right. I think that should give us the desired effect. I'm open to other ideas. Let's keep chatting.

So if I understand you correctly, lets say I place a window in the last fourth of a monitor then move it to another monitor it should maintain its relative position of the last fourth?

Not really. The new size should dictate how the window will be positioned. Please remember that we are prescribing what, we think, is the best position on the next monitor. Like I said before, the position should always be center of the monitor based on the new size. This should work perfectly in most cases, I believe.

@thesobercoder thesobercoder added the enhancement New feature or request label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants