diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 984786068..0b5e7afd4 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -121,7 +121,7 @@ function layout.arrange(screen) local p = {} 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 local padding = ascreen.padding(capi.screen[screen]) or {} p.workarea.x = p.workarea.x + (padding.left or 0) + useless_gap diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 70c36f973..9b8668ec4 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -407,10 +407,16 @@ function tag.incgap(add, t) tag.setgap(tag.getgap(t) + add, t) end ---- Get the spacing between clients --- @param t Optional tag. -function tag.getgap(t) +--- Get the spacing between clients. +-- @tparam[opt=tag.selected()] tag t The tag. +-- @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() + if numclients == 1 then + return 0 + end return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0 end