awful.tag: Rename mwfact to master_width_factor
This commit is contained in:
parent
ff9e74ac0b
commit
e8908e2c62
|
@ -781,7 +781,7 @@ function client.idx(c)
|
||||||
-- based on the how the tiling algorithm places clients we calculate
|
-- based on the how the tiling algorithm places clients we calculate
|
||||||
-- the column, we could easily use the for loop in the program but we can
|
-- the column, we could easily use the for loop in the program but we can
|
||||||
-- calculate it.
|
-- calculate it.
|
||||||
local ncol = t.ncol
|
local ncol = t.column_count
|
||||||
-- minimum number of clients per column
|
-- minimum number of clients per column
|
||||||
local percol = math.floor(nother / ncol)
|
local percol = math.floor(nother / ncol)
|
||||||
-- number of columns with an extra client
|
-- number of columns with an extra client
|
||||||
|
|
|
@ -219,9 +219,9 @@ end
|
||||||
|
|
||||||
capi.screen.add_signal("arrange")
|
capi.screen.add_signal("arrange")
|
||||||
|
|
||||||
capi.tag.connect_signal("property::mwfact", arrange_tag)
|
capi.tag.connect_signal("property::master_width_factor", arrange_tag)
|
||||||
capi.tag.connect_signal("property::nmaster", arrange_tag)
|
capi.tag.connect_signal("property::nmaster", arrange_tag)
|
||||||
capi.tag.connect_signal("property::ncol", arrange_tag)
|
capi.tag.connect_signal("property::column_count", arrange_tag)
|
||||||
capi.tag.connect_signal("property::layout", arrange_tag)
|
capi.tag.connect_signal("property::layout", arrange_tag)
|
||||||
capi.tag.connect_signal("property::windowfact", arrange_tag)
|
capi.tag.connect_signal("property::windowfact", arrange_tag)
|
||||||
capi.tag.connect_signal("property::selected", arrange_tag)
|
capi.tag.connect_signal("property::selected", arrange_tag)
|
||||||
|
|
|
@ -32,7 +32,7 @@ local function do_corner(p, orientation)
|
||||||
-- Use the nmaster field of the tag in a cheaty way
|
-- Use the nmaster field of the tag in a cheaty way
|
||||||
local row_privileged = ((cls[1].screen.selected_tag.nmaster % 2) == 0)
|
local row_privileged = ((cls[1].screen.selected_tag.nmaster % 2) == 0)
|
||||||
|
|
||||||
local master_factor = cls[1].screen.selected_tag.mwfact
|
local master_factor = cls[1].screen.selected_tag.master_width_factor
|
||||||
master.width = master_factor * wa.width
|
master.width = master_factor * wa.width
|
||||||
master.height = master_factor * wa.height
|
master.height = master_factor * wa.height
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ function magnifier.mouse_resize_handler(c, corner, x, y)
|
||||||
|
|
||||||
-- New master width factor
|
-- New master width factor
|
||||||
local mwfact = dist / maxdist_pow
|
local mwfact = dist / maxdist_pow
|
||||||
c.screen.selected_tag.mwfact = math.min(math.max(0.01, mwfact), 0.99)
|
c.screen.selected_tag.master_width_factor
|
||||||
|
= math.min(math.max(0.01, mwfact), 0.99)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +54,7 @@ function magnifier.arrange(p)
|
||||||
local cls = p.clients
|
local cls = p.clients
|
||||||
local focus = p.focus or capi.client.focus
|
local focus = p.focus or capi.client.focus
|
||||||
local t = p.tag or capi.screen[p.screen].selected_tag
|
local t = p.tag or capi.screen[p.screen].selected_tag
|
||||||
local mwfact = t.mwfact
|
local mwfact = t.master_width_factor
|
||||||
local fidx
|
local fidx
|
||||||
|
|
||||||
-- Check that the focused window is on the right screen
|
-- Check that the focused window is on the right screen
|
||||||
|
|
|
@ -29,7 +29,7 @@ tile.resize_jump_to_corner = true
|
||||||
local function mouse_resize_handler(c, _, _, _, orientation)
|
local function mouse_resize_handler(c, _, _, _, orientation)
|
||||||
orientation = orientation or "tile"
|
orientation = orientation or "tile"
|
||||||
local wa = capi.screen[c.screen].workarea
|
local wa = capi.screen[c.screen].workarea
|
||||||
local mwfact = c.screen.selected_tag.mwfact
|
local mwfact = c.screen.selected_tag.master_width_factor
|
||||||
local cursor
|
local cursor
|
||||||
local g = c:geometry()
|
local g = c:geometry()
|
||||||
local offset = 0
|
local offset = 0
|
||||||
|
@ -126,7 +126,8 @@ local function mouse_resize_handler(c, _, _, _, orientation)
|
||||||
wfact = wfact_x
|
wfact = wfact_x
|
||||||
end
|
end
|
||||||
|
|
||||||
c.screen.selected_tag.mwfact = math.min(math.max(new_mwfact, 0.01), 0.99)
|
c.screen.selected_tag.master_width_factor
|
||||||
|
= math.min(math.max(new_mwfact, 0.01), 0.99)
|
||||||
client.setwfact(math.min(math.max(wfact,0.01), 0.99), c)
|
client.setwfact(math.min(math.max(wfact,0.01), 0.99), c)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -211,9 +212,9 @@ local function do_tile(param, orientation)
|
||||||
local nmaster = math.min(t.nmaster, #cls)
|
local nmaster = math.min(t.nmaster, #cls)
|
||||||
local nother = math.max(#cls - nmaster,0)
|
local nother = math.max(#cls - nmaster,0)
|
||||||
|
|
||||||
local mwfact = t.mwfact
|
local mwfact = t.master_width_factor
|
||||||
local wa = param.workarea
|
local wa = param.workarea
|
||||||
local ncol = t.ncol
|
local ncol = t.column_count
|
||||||
|
|
||||||
local data = tag.getdata(t).windowfact
|
local data = tag.getdata(t).windowfact
|
||||||
|
|
||||||
|
|
|
@ -530,53 +530,58 @@ end
|
||||||
--
|
--
|
||||||
-- **Signal:**
|
-- **Signal:**
|
||||||
--
|
--
|
||||||
-- * *property::mwfact*
|
-- * *property::mwfact* (deprecated)
|
||||||
|
-- * *property::master_width_factor*
|
||||||
--
|
--
|
||||||
-- @property mwfact
|
-- @property master_width_factor
|
||||||
-- @param number Between 0 and 1
|
-- @param number Between 0 and 1
|
||||||
-- @see nmaster
|
-- @see nmaster
|
||||||
-- @see ncol
|
-- @see column_count
|
||||||
-- @see master_fill_policy
|
-- @see master_fill_policy
|
||||||
-- @see gap
|
-- @see gap
|
||||||
|
|
||||||
function tag.object.set_mwfact(t, mwfact)
|
function tag.object.set_master_width_factor(t, mwfact)
|
||||||
if mwfact >= 0 and mwfact <= 1 then
|
if mwfact >= 0 and mwfact <= 1 then
|
||||||
tag.setproperty(t, "mwfact", mwfact)
|
tag.setproperty(t, "mwfact", mwfact)
|
||||||
|
tag.setproperty(t, "master_width_factor", mwfact)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_mwfact(t)
|
function tag.object.get_master_width_factor(t)
|
||||||
return tag.getproperty(t, "mwfact") or 0.5
|
return tag.getproperty(t, "master_width_factor") or 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set master width factor.
|
--- Set master width factor.
|
||||||
-- @deprecated awful.tag.setmwfact
|
-- @deprecated awful.tag.setmwfact
|
||||||
-- @see master_fill_policy
|
-- @see master_fill_policy
|
||||||
|
-- @see master_width_factor
|
||||||
-- @param mwfact Master width factor.
|
-- @param mwfact Master width factor.
|
||||||
-- @param t The tag to modify, if null tag.selected() is used.
|
-- @param t The tag to modify, if null tag.selected() is used.
|
||||||
function tag.setmwfact(mwfact, t)
|
function tag.setmwfact(mwfact, t)
|
||||||
util.deprecate("Use t.mwfact = mwfact instead of awful.tag.setmwfact")
|
util.deprecate("Use t.master_width_factor = mwfact instead of awful.tag.setmwfact")
|
||||||
|
|
||||||
tag.object.get_mwfact(t or ascreen.focused().selected_tag, mwfact)
|
tag.object.get_master_width_factor(t or ascreen.focused().selected_tag, mwfact)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Increase master width factor.
|
--- Increase master width factor.
|
||||||
-- @function awful.tag.incmwfact
|
-- @function awful.tag.incmwfact
|
||||||
|
-- @see master_width_factor
|
||||||
-- @param add Value to add to master width factor.
|
-- @param add Value to add to master width factor.
|
||||||
-- @param t The tag to modify, if null tag.selected() is used.
|
-- @param t The tag to modify, if null tag.selected() is used.
|
||||||
function tag.incmwfact(add, t)
|
function tag.incmwfact(add, t)
|
||||||
t = t or t or ascreen.focused().selected_tag
|
t = t or t or ascreen.focused().selected_tag
|
||||||
tag.object.set_mwfact(t, tag.object.get_mwfact(t) + add)
|
tag.object.set_master_width_factor(t, tag.object.get_master_width_factor(t) + add)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get master width factor.
|
--- Get master width factor.
|
||||||
-- @deprecated awful.tag.getmwfact
|
-- @deprecated awful.tag.getmwfact
|
||||||
-- @see mwfact
|
-- @see master_width_factor
|
||||||
|
-- @see master_fill_policy
|
||||||
-- @param[opt] t The tag.
|
-- @param[opt] t The tag.
|
||||||
function tag.getmwfact(t)
|
function tag.getmwfact(t)
|
||||||
util.deprecate("Use t.mwfact instead of awful.tag.getmwfact")
|
util.deprecate("Use t.master_width_factor instead of awful.tag.getmwfact")
|
||||||
|
|
||||||
return tag.object.get_mwfact(t or ascreen.focused().selected_tag)
|
return tag.object.get_master_width_factor(t or ascreen.focused().selected_tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- An ordered list of layouts.
|
--- An ordered list of layouts.
|
||||||
|
@ -805,7 +810,7 @@ end
|
||||||
-- * *property::master_fill_policy*
|
-- * *property::master_fill_policy*
|
||||||
--
|
--
|
||||||
-- @property master_fill_policy
|
-- @property master_fill_policy
|
||||||
-- @param string "expand" or "mwfact"
|
-- @param string "expand" or "master_width_factor"
|
||||||
|
|
||||||
function tag.object.get_master_fill_policy(t)
|
function tag.object.get_master_fill_policy(t)
|
||||||
return tag.getproperty(t, "master_fill_policy") or "expand"
|
return tag.getproperty(t, "master_fill_policy") or "expand"
|
||||||
|
@ -816,7 +821,7 @@ end
|
||||||
-- @see master_fill_policy
|
-- @see master_fill_policy
|
||||||
-- @tparam string policy Can be set to
|
-- @tparam string policy Can be set to
|
||||||
-- "expand" (fill all the available workarea) or
|
-- "expand" (fill all the available workarea) or
|
||||||
-- "mwfact" (fill only an area inside the master width factor)
|
-- "master_width_factor" (fill only an area inside the master width factor)
|
||||||
-- @tparam[opt=tag.selected()] tag t The tag to modify
|
-- @tparam[opt=tag.selected()] tag t The tag to modify
|
||||||
function tag.setmfpol(policy, t)
|
function tag.setmfpol(policy, t)
|
||||||
util.deprecate("Use t.master_fill_policy = policy instead of awful.tag.setmfpol")
|
util.deprecate("Use t.master_fill_policy = policy instead of awful.tag.setmfpol")
|
||||||
|
@ -826,7 +831,7 @@ function tag.setmfpol(policy, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Toggle size fill policy for the master client(s)
|
--- Toggle size fill policy for the master client(s)
|
||||||
-- between "expand" and "mwfact".
|
-- between "expand" and "master_width_factor".
|
||||||
-- @function awful.tag.togglemfpol
|
-- @function awful.tag.togglemfpol
|
||||||
-- @see master_fill_policy
|
-- @see master_fill_policy
|
||||||
-- @tparam tag t The tag to modify, if null tag.selected() is used.
|
-- @tparam tag t The tag to modify, if null tag.selected() is used.
|
||||||
|
@ -834,7 +839,7 @@ function tag.togglemfpol(t)
|
||||||
t = t or ascreen.focused().selected_tag
|
t = t or ascreen.focused().selected_tag
|
||||||
|
|
||||||
if tag.getmfpol(t) == "expand" then
|
if tag.getmfpol(t) == "expand" then
|
||||||
tag.setproperty(t, "master_fill_policy", "mwfact")
|
tag.setproperty(t, "master_fill_policy", "master_width_factor")
|
||||||
else
|
else
|
||||||
tag.setproperty(t, "master_fill_policy", "expand")
|
tag.setproperty(t, "master_fill_policy", "expand")
|
||||||
end
|
end
|
||||||
|
@ -846,7 +851,7 @@ end
|
||||||
-- @tparam[opt=tag.selected()] tag t The tag
|
-- @tparam[opt=tag.selected()] tag t The tag
|
||||||
-- @treturn string Possible values are
|
-- @treturn string Possible values are
|
||||||
-- "expand" (fill all the available workarea, default one) or
|
-- "expand" (fill all the available workarea, default one) or
|
||||||
-- "mwfact" (fill only an area inside the master width factor)
|
-- "master_width_factor" (fill only an area inside the master width factor)
|
||||||
function tag.getmfpol(t)
|
function tag.getmfpol(t)
|
||||||
util.deprecate("Use t.master_fill_policy instead of awful.tag.getmfpol")
|
util.deprecate("Use t.master_fill_policy instead of awful.tag.getmfpol")
|
||||||
|
|
||||||
|
@ -961,51 +966,54 @@ end
|
||||||
--
|
--
|
||||||
-- **Signal:**
|
-- **Signal:**
|
||||||
--
|
--
|
||||||
-- * *property::ncol*
|
-- * *property::ncol* (deprecated)
|
||||||
|
-- * *property::column_count*
|
||||||
--
|
--
|
||||||
-- @property ncol
|
-- @property column_count
|
||||||
-- @param integer ncol Has to be greater than 1
|
-- @tparam integer ncol Has to be greater than 1
|
||||||
|
|
||||||
function tag.object.set_ncol(t, ncol)
|
function tag.object.set_column_count(t, ncol)
|
||||||
if ncol >= 1 then
|
if ncol >= 1 then
|
||||||
tag.setproperty(t, "ncol", ncol)
|
tag.setproperty(t, "ncol", ncol)
|
||||||
|
tag.setproperty(t, "column_count", ncol)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_ncol(t)
|
function tag.object.get_column_count(t)
|
||||||
return tag.getproperty(t, "ncol") or 1
|
return tag.getproperty(t, "column_count") or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set number of column windows.
|
--- Set number of column windows.
|
||||||
-- @deprecated awful.tag.setncol
|
-- @deprecated awful.tag.setncol
|
||||||
-- @see ncol
|
-- @see column_count
|
||||||
-- @param ncol The number of column.
|
-- @param ncol The number of column.
|
||||||
-- @param t The tag to modify, if null tag.selected() is used.
|
-- @param t The tag to modify, if null tag.selected() is used.
|
||||||
function tag.setncol(ncol, t)
|
function tag.setncol(ncol, t)
|
||||||
util.deprecate("Use t.ncol = new_index instead of awful.tag.setncol")
|
util.deprecate("Use t.column_count = new_index instead of awful.tag.setncol")
|
||||||
|
|
||||||
t = t or ascreen.focused().selected_tag
|
t = t or ascreen.focused().selected_tag
|
||||||
if ncol >= 1 then
|
if ncol >= 1 then
|
||||||
tag.setproperty(t, "ncol", ncol)
|
tag.setproperty(t, "ncol", ncol)
|
||||||
|
tag.setproperty(t, "column_count", ncol)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get number of column windows.
|
--- Get number of column windows.
|
||||||
-- @deprecated awful.tag.getncol
|
-- @deprecated awful.tag.getncol
|
||||||
-- @see ncol
|
-- @see column_count
|
||||||
-- @param[opt] t The tag.
|
-- @param[opt] t The tag.
|
||||||
function tag.getncol(t)
|
function tag.getncol(t)
|
||||||
util.deprecate("Use t.ncol instead of awful.tag.getncol")
|
util.deprecate("Use t.column_count instead of awful.tag.getncol")
|
||||||
|
|
||||||
t = t or ascreen.focused().selected_tag
|
t = t or ascreen.focused().selected_tag
|
||||||
return tag.getproperty(t, "ncol") or 1
|
return tag.getproperty(t, "column_count") or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Increase number of column windows.
|
--- Increase number of column windows.
|
||||||
-- @function awful.tag.incncol
|
-- @function awful.tag.incncol
|
||||||
-- @param add Value to add to number of column windows.
|
-- @param add Value to add to number of column windows.
|
||||||
-- @param[opt] t The tag to modify, if null tag.selected() is used.
|
-- @param[opt] t The tag to modify, if null tag.selected() is used.
|
||||||
-- @tparam[opt=false] boolean sensible Limit ncol based on the number of visible
|
-- @tparam[opt=false] boolean sensible Limit column_count based on the number of visible
|
||||||
-- tiled windows?
|
-- tiled windows?
|
||||||
function tag.incncol(add, t, sensible)
|
function tag.incncol(add, t, sensible)
|
||||||
t = t or ascreen.focused().selected_tag
|
t = t or ascreen.focused().selected_tag
|
||||||
|
@ -1016,7 +1024,7 @@ function tag.incncol(add, t, sensible)
|
||||||
local nmaster = tag.object.get_nmaster(t)
|
local nmaster = tag.object.get_nmaster(t)
|
||||||
local nsecondary = ntiled - nmaster
|
local nsecondary = ntiled - nmaster
|
||||||
|
|
||||||
local ncol = tag.object.get_ncol(t)
|
local ncol = tag.object.get_column_count(t)
|
||||||
if ncol > nsecondary then
|
if ncol > nsecondary then
|
||||||
ncol = nsecondary
|
ncol = nsecondary
|
||||||
end
|
end
|
||||||
|
@ -1026,9 +1034,9 @@ function tag.incncol(add, t, sensible)
|
||||||
newncol = nsecondary
|
newncol = nsecondary
|
||||||
end
|
end
|
||||||
|
|
||||||
tag.object.set_ncol(t, newncol)
|
tag.object.set_column_count(t, newncol)
|
||||||
else
|
else
|
||||||
tag.object.set_ncol(t, tag.object.get_ncol(t) + add)
|
tag.object.set_column_count(t, tag.object.get_column_count(t) + add)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1304,9 +1312,11 @@ capi.tag.add_signal("property::icon")
|
||||||
capi.tag.add_signal("property::icon_only")
|
capi.tag.add_signal("property::icon_only")
|
||||||
capi.tag.add_signal("property::layout")
|
capi.tag.add_signal("property::layout")
|
||||||
capi.tag.add_signal("property::mwfact")
|
capi.tag.add_signal("property::mwfact")
|
||||||
|
capi.tag.add_signal("property::master_width_factor")
|
||||||
capi.tag.add_signal("property::useless_gap")
|
capi.tag.add_signal("property::useless_gap")
|
||||||
capi.tag.add_signal("property::master_fill_policy")
|
capi.tag.add_signal("property::master_fill_policy")
|
||||||
capi.tag.add_signal("property::ncol")
|
capi.tag.add_signal("property::ncol")
|
||||||
|
capi.tag.add_signal("property::column_count")
|
||||||
capi.tag.add_signal("property::nmaster")
|
capi.tag.add_signal("property::nmaster")
|
||||||
capi.tag.add_signal("property::windowfact")
|
capi.tag.add_signal("property::windowfact")
|
||||||
capi.tag.add_signal("property::screen")
|
capi.tag.add_signal("property::screen")
|
||||||
|
|
|
@ -9,8 +9,10 @@ local function new_tag(_, args)
|
||||||
ret:add_signal("property::name")
|
ret:add_signal("property::name")
|
||||||
ret:add_signal("property::geometry")
|
ret:add_signal("property::geometry")
|
||||||
ret:add_signal("property::screen")
|
ret:add_signal("property::screen")
|
||||||
|
ret:add_signal("property::master_width_factor")
|
||||||
ret:add_signal("property::mwfact")
|
ret:add_signal("property::mwfact")
|
||||||
ret:add_signal("property::ncol")
|
ret:add_signal("property::ncol")
|
||||||
|
ret:add_signal("property::column_count")
|
||||||
ret:add_signal("property::nmaster")
|
ret:add_signal("property::nmaster")
|
||||||
ret:add_signal("property::index")
|
ret:add_signal("property::index")
|
||||||
ret:add_signal("property::useless_gap")
|
ret:add_signal("property::useless_gap")
|
||||||
|
|
|
@ -79,8 +79,8 @@ function()
|
||||||
|
|
||||||
assert(old_c.ontop)
|
assert(old_c.ontop)
|
||||||
|
|
||||||
-- Now, test the mwfact
|
-- Now, test the master_width_factor
|
||||||
assert(t.mwfact == 0.5)
|
assert(t.master_width_factor == 0.5)
|
||||||
|
|
||||||
get_callback({modkey}, "l")()
|
get_callback({modkey}, "l")()
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ end,
|
||||||
function()
|
function()
|
||||||
local _, t = get_c_and_t()
|
local _, t = get_c_and_t()
|
||||||
|
|
||||||
assert(t.mwfact == 0.55)
|
assert(t.master_width_factor == 0.55)
|
||||||
|
|
||||||
-- Now, test the nmaster
|
-- Now, test the nmaster
|
||||||
assert(t.nmaster == 1)
|
assert(t.nmaster == 1)
|
||||||
|
@ -107,8 +107,8 @@ function()
|
||||||
|
|
||||||
assert(t.nmaster == 2)
|
assert(t.nmaster == 2)
|
||||||
|
|
||||||
-- Now, test the ncol
|
-- Now, test the column_count
|
||||||
assert(t.ncol == 1)
|
assert(t.column_count == 1)
|
||||||
|
|
||||||
get_callback({modkey, "Control"}, "h")()
|
get_callback({modkey, "Control"}, "h")()
|
||||||
get_callback({modkey, "Shift" }, "l")()
|
get_callback({modkey, "Shift" }, "l")()
|
||||||
|
@ -120,7 +120,7 @@ end,
|
||||||
function()
|
function()
|
||||||
local _, t = get_c_and_t()
|
local _, t = get_c_and_t()
|
||||||
|
|
||||||
assert(t.ncol == 2)
|
assert(t.column_count == 2)
|
||||||
|
|
||||||
-- Now, test the switching tag
|
-- Now, test the switching tag
|
||||||
assert(t.index == 1)
|
assert(t.index == 1)
|
||||||
|
|
Loading…
Reference in New Issue