Only use useless_gap with multiple tiled clients

Fixes https://github.com/awesomeWM/awesome/issues/564.
Closes https://github.com/awesomeWM/awesome/pull/568.
This commit is contained in:
Daniel Hahler 2015-11-19 20:33:04 +01:00
parent 6ca85af53b
commit 269bb90e18
2 changed files with 10 additions and 4 deletions

View File

@ -121,7 +121,7 @@ function layout.arrange(screen)
local p = {} local p = {}
p.workarea = capi.screen[screen].workarea p.workarea = capi.screen[screen].workarea
local useless_gap = tag.getgap(tag.selected(screen)) local useless_gap = tag.getgap(tag.selected(screen), #client.tiled(s))
-- Handle padding -- Handle padding
local padding = ascreen.padding(capi.screen[screen]) or {} local padding = ascreen.padding(capi.screen[screen]) or {}
p.workarea.x = p.workarea.x + (padding.left or 0) + useless_gap p.workarea.x = p.workarea.x + (padding.left or 0) + useless_gap

View File

@ -407,10 +407,16 @@ function tag.incgap(add, t)
tag.setgap(tag.getgap(t) + add, t) tag.setgap(tag.getgap(t) + add, t)
end end
--- Get the spacing between clients --- Get the spacing between clients.
-- @param t Optional tag. -- @tparam[opt=tag.selected()] tag t The tag.
function tag.getgap(t) -- @tparam[opt] int numclients Number of (tiled) clients. Passing this will
-- return 0 for a single client. You can override this function to change
-- this behavior.
function tag.getgap(t, numclients)
local t = t or tag.selected() local t = t or tag.selected()
if numclients == 1 then
return 0
end
return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0 return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0
end end