bakkeby / dwm-vanitygaps

My dwm vanitygaps build (incl. individual patches)
MIT License
24 stars 1 forks source link

window sizes off with large gaps #7

Closed uoou closed 4 years ago

uoou commented 4 years ago

I noticed that with a tile layout and large gaps (40 outside, 30 inside), windows were incorrect sizes. With a 0.5 ratio, the left window would be wider than the right windows.

My guess is that it was adding/subtracting the gaps at the wrong point and coming up with numbers that were wrong but looked ok with smaller gaps.

I only use tile (and monocle) layout, so in my version I stripped the code down to that. I fiddled around and got the windows to the correct size. My version is here:

https://gitlab.com/uoou/dotfiles/blob/master/suckless/dwm_diffs/dwm_vanitygaps.diff

You can see in the two resize calls in tile() I've, after a lot of trial and error because I really don't know what I'm doing, subtracted the outside h-gap from the widths.

I'm not submitting a patch because, as I say, I really don't know what I'm doing - I just fiddled around until the widths were right under my usages. I'm aware that this might not be the right fix for all (or any) layouts.

bakkeby commented 4 years ago

Hi @uoou,

Yes you are absolutely right.

I've, after a lot of trial and error because I really don't know what I'm doing

That's exactly how I started. Besides the cryptic variable names it clearly doesn't help that the tile implementation is geared towards brevity rather than something that is more intuitive.

You have fiddled this yourself so I assume you know this already, but the way it works is that it calculates the coordinates and size of the first client, then it calculates the coordinates and size of the next client relative to the first, and so on. It is rather complex when you want to add gaps or cfacts, which is part of the reason why I ended up with the issue you are describing.

After fiddling a lot with this while adding vanitygaps compatibility with the other layout options I came to the conclusion that it makes a lot more sense to determine the height and width of clients upfront, then position them out accordingly.

I have a this in my dwm-flexipatch build, you might want to refer to that if you end up taking cfacts as well.

I'll backport these to the diff files here.

Thanks,

-Stein

bakkeby commented 4 years ago

Backported now, thanks for reporting.