From fb4a3310149387c027de296bc252e151bf57eb9b Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 16 Jul 2015 11:48:18 +0200 Subject: [PATCH] feat(lib: awful: layout: suit: tile): add support for 'master_fill_policy' --- lib/awful/layout/suit/tile.lua | 6 +++++- lib/awful/tag.lua | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/awful/layout/suit/tile.lua b/lib/awful/layout/suit/tile.lua index ba0a524e7..4b4fb367f 100644 --- a/lib/awful/layout/suit/tile.lua +++ b/lib/awful/layout/suit/tile.lua @@ -216,13 +216,17 @@ local function do_tile(param, orientation) place_master = false end + local grow_master = tag.getmfpol(t) == "expand" -- this was easier than writing functions because there is a lot of data we need for d = 1,2 do if place_master and nmaster > 0 then local size = wa[width] - if nother > 0 then + if nother > 0 or not grow_master then size = math.min(wa[width] * mwfact, wa[width] - (coord - wa[x])) end + if nother == 0 and not grow_master then + coord = coord + (wa[width] - size)/2 + end if not data[0] then data[0] = {} end diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 97d345c81..694c72687 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -409,7 +409,7 @@ function tag.getgap(t) return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0 end ---- Set sizing policy for the master client(s) +--- Set size fill policy for the master client(s) -- @tparam string policy Can be set to -- "expand" (fill all the available workarea) or -- "mwfact" (fill only an area inside the master width factor) @@ -419,7 +419,7 @@ function tag.setmfpol(enabled, t) tag.setproperty(t, "master_fill_policy", enabled) end ---- Toggle sizing policy for the master client(s) +--- Toggle size fill policy for the master client(s) -- @tparam tag t The tag to modify, if null tag.selected() is used. function tag.togglemfpol(t) if tag.getmfpol(t) == "expand" then @@ -429,7 +429,7 @@ function tag.togglemfpol(t) end end ---- Get sizing policy for the master client(s) +--- Get size fill policy for the master client(s) -- @tparam tag t Optional tag. -- @treturn string Can be set to -- "expand" (fill all the available workarea) or