From 269bb90e186b7afe96aac1b54efd49eb07dde4f8 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 19 Nov 2015 20:33:04 +0100 Subject: [PATCH] Only use useless_gap with multiple tiled clients Fixes https://github.com/awesomeWM/awesome/issues/564. Closes https://github.com/awesomeWM/awesome/pull/568. --- lib/awful/layout/init.lua | 2 +- lib/awful/tag.lua | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 98478606..0b5e7afd 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 70c36f97..9b8668ec 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