quicktile icon indicating copy to clipboard operation
quicktile copied to clipboard

"Already tiled" detection is too permissive when used with monitor-switch

Open PeterPablo opened this issue 12 years ago • 1 comments

Thank you for the great update! Now usage of quicktile (current commit) with a two monitor setup with XFCE (panel spanning the the lower part of the left monitor) is very nice!

I observed a small issue:

  • First I resize a window to the lower left quarter of the left monitor. (fine)
  • Now I move the window over to the second monitor. Since there is no toolbar I have a small gap to the lower bound of the monitor. (fine, since by design)
  • Now I want to resize the window to again fill the lower left quarter of the right monitor, in order to fill the gap. This does not work as expected, since quicktile remebers the last resizing action to be "lower left quarter" and as such now resizes the window to the next smaller size "lower left sixth".

I would expect that moving a window to the next monitor to reset the last remembered action so that the window would be resized to "lower left quarter", inspite of "lower left sixth".

Hopefully my explanation is understandable.

Peter

PeterPablo avatar Oct 11 '13 14:10 PeterPablo

Actually, that's a flaw in how QuickTile currently detects whether a window is tiled.

Because I haven't yet figured out the cleanest, most reliable way to get a window's size after the window manager has made whatever adjustments it wants to a size request (eg. Try tiling gVim or a terminal window and notice that its dimensions snap to a multiple of the character rows and columns) but before you do anything else, QuickTile currently just guesses based on whether the window size is "close enough".

When you move the window to your other monitor, QuickTile does take the new monitor dimensions into account but, since the window's size is still within 100px (by euclidean distance) of the target size, it considers it "already tiled". (In other words, you wouldn't have noticed the problem if your panel was more than 100px thick or your monitors were of different resolutions.)

I have two fixes planned, both of which may solve your problem:

  1. See feature request #24 where I've announced my intentions to either change monitor-switch or make a new variant of it so it'll automatically adjust the sizes of tiled windows when switching monitors so they'll fit the new meaning of the chosen preset.
  2. In order to implement feature #10, I'll also need a more advanced way to detect "already tiled" which would fix this problem as a side-effect.

I originally chose 100px to be generous because I didn't trust my code to reliably get a window's dimensions including window borders but, since that seems to be somewhat solid now, I should probably think about a less lax approach if I don't end up writing the proper solution soon. (Maybe querying the window for the sizing hints it sends to the window manager)

In the mean time, you can experiment with different values yourself. Just find the line that says if min_distance[0] < 100: (currently line 762) and change that number to something smaller.

ssokolow avatar Oct 11 '13 16:10 ssokolow