awesome-treetile icon indicating copy to clipboard operation
awesome-treetile copied to clipboard

doesn't support useless gaps

Open DanielFGray opened this issue 8 years ago • 12 comments

treesome added it with https://github.com/RobSis/treesome/commit/256250d3f7628e56f5d6998ae9b4bceb88f1bc78

hopefully wouldn't be too much trouble to add support for treetile?

DanielFGray avatar Jan 22 '17 04:01 DanielFGray

Hi @DanielFGray ,

I should be no problems. I will add it as soon as possible

guotsuan avatar Jan 23 '17 12:01 guotsuan

in awesome 4.0 the variable is useless_gap for native gaps, treesome was using useless_gap_width which was defined by the copycat-killer/lain library

DanielFGray avatar Jan 26 '17 07:01 DanielFGray

Any news on this one?

GrayJack avatar Jun 29 '18 06:06 GrayJack

I've just created a pull request for this. After a long while of playing around with it, I was able to get useless_gap support working fine.

0xC0ncord avatar Oct 14 '18 02:10 0xC0ncord

That's pretty cool and works well, but it seems like the gap is about 1-2 pixel too small, as seen in the following screenshots. The first one is with treetile and the second is with the default tile layout.

screenshot20181014162211 screenshot20181014162209

mphe avatar Oct 14 '18 14:10 mphe

That's pretty cool and works well, but it seems like the gap is about 1-2 pixel too small

I think that has something to do with the tag's padding/border property. I noticed the issue before but it doesn't appear to be related to the useless_gap property directly. The effect is even more noticeable when you bump up useless_gap to something like 32. I haven't dug deep enough into other layouts' code to see where this effect comes from to find out how to fix it yet.

0xC0ncord avatar Oct 14 '18 14:10 0xC0ncord

I quickly looked into it and changed the two lines (507, 643) where useless_gap is set to this:

useless_gap = useless_gap * 2.0 + beautiful.border_width * 2

This seems to deliver correct gaps between the clients, but the outer border extends to the right/bottom respectively. So, theoretically it should work when the available screen space is adapted to be border_width * 2 pixels smaller. I tried adding 2 lines at the top of do_treetile, and it seems to work mostly, but not in some cases, like closing a window, which would sometimes lead to wrong sizes and overlaps (see screenshot). Haven't found out yet how to consistently reproduce this.

local area = p.workarea
area.width = area.width - beautiful.border_width * 2;
area.height = area.height - beautiful.border_width * 2;

screenshot20181014172612

mphe avatar Oct 14 '18 15:10 mphe

I think border_width is the property I was trying to track down while investigating this a while back. I'm still not certain what it is even supposed to do. The documentation states it's just "the client's border width" which doesn't tell me much of anything. There might be some answers in the lain layouts and how they deal with this.

0xC0ncord avatar Oct 14 '18 15:10 0xC0ncord

Well, it's the border drawn around clients. If that still doesn't help, try setting it to a higher value to make it more noticable.

mphe avatar Oct 14 '18 16:10 mphe

Well, it's the border drawn around clients. If that still doesn't help, try setting it to a higher value to make it more noticable.

Aha. That's it. It doesn't look like border_width has anything to do with the spacing issue here... Even if I set border_width to some obscene number like 128 it doesn't appear to change the positioning of clients at all - it just adds an internal padding to the actual space that the client is allowed to draw on.

0xC0ncord avatar Oct 14 '18 16:10 0xC0ncord

I stand corrected. Using the attached code I was able to get treetile's first horizontal split with only two clients to mimic the basic tile layout in the lain library perfectly, but after adding more clients and removing them it gets really weird and inconsistent. I haven't messed with resizing clients yet though.

init.lua.txt

0xC0ncord avatar Oct 15 '18 21:10 0xC0ncord

I've also been fiddling around with it for a bit and got it mostly working using the code modifications I mentioned earlier. Unfortunetly removing clients doesn't always work as it should. But I found out how to consistently reproduce it:

  • Open 6 windows, should look like this:
 _______ _______
|       |       |
|       |___ ___|
|       |   |___|
|_______|___|_|_|
  • Focus 3rd window (the one marked with an x)
 _______ _______
|       |       |
|       |___ ___|
|       |x  |___|
|_______|___|_|_|
  • Close it
  • Should now look like this:
 _______ _______
|       |       |
|       |_______|
|       |_______|
|_______|___|___|

The bottom two windows on the right side should now overlap.

Unfortunetly my understanding of the treetile code is rather limited, so I have no idea how to fix that. Maybe you have an idea. Resizing is also broken, but was, as you said, already before.

Here's the code I used: init.lua.txt

mphe avatar Oct 18 '18 00:10 mphe