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

Keep tiled window ratio #9

Open
lepa22 opened this issue Sep 9, 2019 · 8 comments
Open

Keep tiled window ratio #9

lepa22 opened this issue Sep 9, 2019 · 8 comments

Comments

@lepa22
Copy link

lepa22 commented Sep 9, 2019

I have two monitors. The left one has a resolution of 1920x1080 pixels and the right one has a resolution of 1366x768 pixels.

Currently, if a window is tiled in one screen, say to the right of the right monitor, and then it's moved to the left screen, the window is not tiled any more. Its vertical size correctly adapts to the screen size, however its horizontal size doesn't change to account for the difference in screen resolution. Also it isn't positioned at the edge of the screen anymore. See screenshots below.

  • Example case 1:

Window tiled to the right of the right monitor.

Screenshot_2019-09-09_12-09-22

Window is not tiled when moved to the left monitor and has wrong horizontal ratio for this monitor.

Screenshot_2019-09-09_12-08-28

  • Example case 2:

Window tiled to the right of the left monitor.

Screenshot_2019-09-09_12-09-02

Window is not tiled when moved to the right monitor and has wrong horizontal ratio for this monitor.

Screenshot_2019-09-09_12-09-13

  • Expected behavior.

Window tiled to the right of the right monitor.

Screenshot_2019-09-09_12-08-10

Window is still tiled when moved to the left monitor and has the correct horizontal ratio for this monitor.

Screenshot_2019-09-09_12-09-02

@calandoa
Copy link
Owner

Hi Lepa,

I have just committed a new version with -r option which should implement what you wanted. Can you please have a try?

@lepa22
Copy link
Author

lepa22 commented Sep 12, 2019

Hi calandoa! Thank you for your quick response and action!

The -r option certainly improves the problem. However, the window slowly drifts away from the screen edge after tiling it and moving it back and forth between the screens several times.

I also noticed that, if you have a window tiled to the upper half of the screen that has the panel and then move it to the other screen, the window does not touch the screen edge, but there is a gap, approximately the size of the panel. This gap does not exist for left/right tiling.

@calandoa
Copy link
Owner

1st prb: I tried to reproduce this but I could not. You can try to put: print npos, nsiz line 128, just before the if dir == fit, then put the same code line 144, after the if block, to check what has changed. You can then paste me the log here.

If you try this through your WM, you will not get the output, so you can do it in a terminal:
movescreen.py -r right 0x2800024
movescreen.py -r left 0x2800024

you can get the window id with xwininfo

2nd prb: yes, I know the problem. This is possible to handle by requesting panel size etc... but I will not adress this at it is too complicated. If your window is perfectly maximized (horizontally or vertically or both) by using WM shortcuts, it should be maximized also after each move so this issue would not happen.

@lepa22
Copy link
Author

lepa22 commented Sep 16, 2019

For the first problem, I did what you said and this is the output, after first tiling a terminal window on the right monitor and then moving it between the monitors:

[2603, 0] [675, 738]
[960, 20] [948, 1026]
[2603, 0] [668, 738]
[960, 20] [934, 1026]
[2603, 0] [661, 738]
[960, 20] [927, 1026]
[2603, 0] [654, 722]
[960, 20] [913, 1010]
[2603, 14] [647, 706]
[960, 20] [906, 978]
[2603, 14] [640, 690]
[960, 20] [899, 962]
[2603, 14] [633, 674]
[960, 20] [885, 946]

The drifting is more visible for terminal windows, however still visible for me for every other window.

As for the second problem, I respect that you don't want to address that. When I'll have more time, I may look into this and let you know.

@calandoa
Copy link
Owner

I could not reproduce your problem with such a drift as yours, but I could see some small differences on my side too. I have just added a better rounding in the calculus that might solve your issue.

@lepa22
Copy link
Author

lepa22 commented Sep 19, 2019

Still it isn't fixed, but it is certainly improved.

The drift is still significant for the xfce4-terminal and I think that this is because, when the terminal is tiled, it doesn't occupy all the screen space, but its size is always an integer amount of lines.

For the rest of the windows, e.g. Thunar, vscode etc, I can notice a thin one pixel line of the window on the right screen, when the window is tiled to the right and moved between the screens (refer to my screenshots above for my monitor setup). If the window is tiled to the left, there is still this one pixel increase in size and you can notice it if you then press the shortcut to tile it. It moves just one pixel.

@calandoa
Copy link
Owner

Ok, so I guess I fully understood the problem now after several tests. For this I add print scr, npos, nsiz before and after the big if block around line 135, then I use movescreen.py -r left $WINDOWID command then right then left, etc... and compare the old and new size.

  • xfce4-terminal use only discrete size as you say, and when changing size it seems to use a flawed algorithm to compute the new size

  • gnome-terminal has the same problem

  • xterm is working fine, despite using discrete size too (I cannot understand how this can works BTW!)

  • Eterm and lxterm are fine too

  • qterminal is working fine, but uses continuous size

  • konsole is changing the position too, which is the worst behavior

So finally I do not see any simple way to work around the problem, as I do not see how it would be possible to know in advance the size rule of the application and prevent it potential flawed algorithm to happen.

@lepa22
Copy link
Author

lepa22 commented Sep 29, 2019

OK. Thanks for looking into this anyway!

Would it be possible for you to fix the one pixel problem for the rest of the windows?

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

No branches or pull requests

2 participants