mogenson/PaperWM.spoon

Respect window gap when computing window widths

Closed this issue · 2 comments

Hi!

When using a window gap, windows that seem like they should fit the whole screen perfectly if they are next to each other result in some scrolling when switching between them. Could the window gap be taken into consideration so that there is no scrolling motion?

For example, assume we have

  • Two windows
  • The first has the width ratio 0.38195
  • The second has the width ratio 0.61804
  • The window gap is 30px

Then I would like the windows to fill the screen nicely since 0.38195 + 0.61804 = 0.999... But instead the unfocused window bleed into the outer window gap resulting in some scrolling when switching between the windows. See demo below.

Screen.Recording.2023-09-15.at.21.09.08.mov

Happy to make a PR!

I believe this is how they do it in the Gnome PaperWM: https://github.com/paperwm/PaperWM/blob/3986699cd814ffdd7a1aa65f30ffe4d31df83d52/tiling.js#L3773-L3776

I think we can do better though, to fit any number of windows where the ratios sum up to 1.

Ah I see. I think this would be a great addition to PaperWM.spoon. If you'd like to submit a PR I would be happy to review and merge it. Thanks!