Merge pull request #323 from actionless/grow-master
Add "master_fill_policy" tag property and its support in "tile" and "corner" layouts Closes https://github.com/awesomeWM/awesome/pull/323/files.
This commit is contained in:
commit
2b2c230f43
|
@ -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
|
||||
|
|
|
@ -89,7 +89,7 @@ local function do_corner(p, orientation)
|
|||
row.x_increment = row.win_width
|
||||
row.win_idx = 0
|
||||
|
||||
-- Extend master if there is only a few windows
|
||||
-- Extend master if there is only a few windows and "expand" policy is set
|
||||
if #cls < 3 then
|
||||
if row_privileged then
|
||||
master.x = wa.x
|
||||
|
@ -98,8 +98,13 @@ local function do_corner(p, orientation)
|
|||
master.y = wa.y
|
||||
master.height = wa.height
|
||||
end
|
||||
if #cls < 2 then
|
||||
master = wa
|
||||
if #cls < 2 then
|
||||
if tag.getmfpol(t) == "expand" then
|
||||
master = wa
|
||||
else
|
||||
master.x = master.x + (wa.width - master.width)/2
|
||||
master.y = master.y + (wa.height - master.height)/2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -234,13 +234,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
|
||||
|
|
|
@ -410,6 +410,37 @@ function tag.getgap(t)
|
|||
return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0
|
||||
end
|
||||
|
||||
--- 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)
|
||||
-- @tparam[opt=tag.selected()] tag t The tag to modify
|
||||
function tag.setmfpol(policy, t)
|
||||
local t = t or tag.selected()
|
||||
tag.setproperty(t, "master_fill_policy", policy)
|
||||
end
|
||||
|
||||
--- Toggle size fill policy for the master client(s)
|
||||
-- between "expand" and "mwfact"
|
||||
-- @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 size fill policy for the master client(s)
|
||||
-- @tparam[opt=tag.selected()] tag t The tag
|
||||
-- @treturn string Possible values are
|
||||
-- "expand" (fill all the available workarea, default one) 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.
|
||||
|
@ -703,6 +734,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")
|
||||
|
|
Loading…
Reference in New Issue