From 00283492268d8315f4b9c257517b93b620c3cb34 Mon Sep 17 00:00:00 2001 From: actionless Date: Wed, 15 Jul 2015 15:24:08 +0200 Subject: [PATCH] feat(lib: awful: tag, layout): add 'master_fill_policy' property to tag --- lib/awful/layout/init.lua | 1 + lib/awful/tag.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 11e65bd2..98478606 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -192,6 +192,7 @@ capi.tag.connect_signal("property::windowfact", arrange_tag) capi.tag.connect_signal("property::selected", arrange_tag) capi.tag.connect_signal("property::activated", arrange_tag) capi.tag.connect_signal("property::useless_gap", arrange_tag) +capi.tag.connect_signal("property::master_fill_policy", arrange_tag) capi.tag.connect_signal("tagged", arrange_tag) for s = 1, capi.screen.count() do diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 93ad2ae2..97d345c8 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -409,6 +409,36 @@ 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) +-- @tparam string policy Can be set to +-- "expand" (fill all the available workarea) or +-- "mwfact" (fill only an area inside the master width factor) +-- @tparam tag t The tag to modify, if null tag.selected() is used. +function tag.setmfpol(enabled, t) + local t = t or tag.selected() + tag.setproperty(t, "master_fill_policy", enabled) +end + +--- Toggle sizing 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 + tag.setmfpol("mwfact", t) + else + tag.setmfpol("expand", t) + end +end + +--- Get sizing policy for the master client(s) +-- @tparam tag t Optional tag. +-- @treturn string Can be set to +-- "expand" (fill all the available workarea) or +-- "mwfact" (fill only an area inside the master width factor) +function tag.getmfpol(t) + local t = t or tag.selected() + return tag.getproperty(t, "master_fill_policy") or "expand" +end + --- Set the number of master windows. -- @param nmaster The number of master windows. -- @param[opt] t The tag. @@ -702,6 +732,7 @@ capi.tag.add_signal("property::icon_only") capi.tag.add_signal("property::layout") capi.tag.add_signal("property::mwfact") capi.tag.add_signal("property::useless_gap") +capi.tag.add_signal("property::master_fill_policy") capi.tag.add_signal("property::ncol") capi.tag.add_signal("property::nmaster") capi.tag.add_signal("property::windowfact")