awful.tag: moved defaults to a local variable
This commit is contained in:
parent
8ee3611848
commit
5844bd0ade
|
@ -139,9 +139,11 @@ function layout.parameters(t, screen)
|
||||||
|
|
||||||
local clients = client.tiled(screen)
|
local clients = client.tiled(screen)
|
||||||
local gap_single_client = true
|
local gap_single_client = true
|
||||||
if(t and not (t.gap_single_client == nil)) then
|
|
||||||
|
if(t and t.gap_single_client ~= nil) then
|
||||||
gap_single_client = t.gap_single_client
|
gap_single_client = t.gap_single_client
|
||||||
end
|
end
|
||||||
|
|
||||||
local min_clients = gap_single_client and 1 or 2
|
local min_clients = gap_single_client and 1 or 2
|
||||||
local useless_gap = t and (#clients >= min_clients and t.gap or 0) or 0
|
local useless_gap = t and (#clients >= min_clients and t.gap or 0) or 0
|
||||||
|
|
||||||
|
|
|
@ -42,39 +42,25 @@ tag.history = {}
|
||||||
tag.history.limit = 20
|
tag.history.limit = 20
|
||||||
|
|
||||||
-- Default values
|
-- Default values
|
||||||
tag.defaults = {}
|
local defaults = {}
|
||||||
--- The gap between clients (in points).
|
|
||||||
-- @tfield[opt=0] integer tag.defaults.gap
|
-- The gap between clients (in points).
|
||||||
-- @tparam[opt=0] integer gap
|
defaults.gap = 0
|
||||||
-- @see gap
|
|
||||||
-- @see gap_single_client
|
-- The default gap_count.
|
||||||
tag.defaults.gap = 0
|
defaults.gap_single_client = true
|
||||||
--- The default gap_count.
|
|
||||||
-- @tfield[opt=true] boolean tag.defaults.gap_single_client
|
-- The default master fill policy.
|
||||||
-- @tparam[opt=true] boolean gap_single_client
|
defaults.master_fill_policy = "expand"
|
||||||
-- @see gap
|
|
||||||
-- @see gap_single_client
|
-- The default master width factor.
|
||||||
tag.defaults.gap_single_client = true
|
defaults.master_width_factor = 0.5
|
||||||
--- The default master fill policy.
|
|
||||||
-- @tfield[opt="expand"] string tag.defaults.master_fill_policy
|
-- The default master count.
|
||||||
-- @tparam[opt="expand"] string master_fill_policy
|
defaults.master_count = 1
|
||||||
-- @see master_fill_policy
|
|
||||||
tag.defaults.master_fill_policy = "expand"
|
-- The default column count.
|
||||||
--- The default master width factor.
|
defaults.column_count = 1
|
||||||
-- @tfield[opt=0.5] number tag.defaults.master_width_factor
|
|
||||||
-- @tparam[opt=0.5] number master_width_factor
|
|
||||||
-- @see master_width_factor
|
|
||||||
tag.defaults.master_width_factor = 0.5
|
|
||||||
--- The default master count.
|
|
||||||
-- @tfield[opt=1] integer tag.defaults.master_count
|
|
||||||
-- @tparam[opt=1] integer master_count
|
|
||||||
-- @see master_count
|
|
||||||
tag.defaults.master_count = 1
|
|
||||||
--- The default column count.
|
|
||||||
-- @tfield[opt=1] integer tag.defaults.column_count
|
|
||||||
-- @tparam[opt=1] integer column_count
|
|
||||||
-- @see column_count
|
|
||||||
tag.defaults.column_count = 1
|
|
||||||
|
|
||||||
-- screen.tags depend on index, it cannot be used by awful.tag
|
-- screen.tags depend on index, it cannot be used by awful.tag
|
||||||
local function raw_tags(scr)
|
local function raw_tags(scr)
|
||||||
|
@ -604,7 +590,6 @@ end
|
||||||
-- @see column_count
|
-- @see column_count
|
||||||
-- @see master_fill_policy
|
-- @see master_fill_policy
|
||||||
-- @see gap
|
-- @see gap
|
||||||
-- @see tag.defaults.master_width_factor
|
|
||||||
|
|
||||||
function tag.object.set_master_width_factor(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
|
||||||
|
@ -614,7 +599,9 @@ function tag.object.set_master_width_factor(t, mwfact)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_master_width_factor(t)
|
function tag.object.get_master_width_factor(t)
|
||||||
return tag.getproperty(t, "master_width_factor") or beautiful.master_width_factor or tag.defaults.master_width_factor
|
return tag.getproperty(t, "master_width_factor")
|
||||||
|
or beautiful.master_width_factor
|
||||||
|
or defaults.master_width_factor
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set master width factor.
|
--- Set master width factor.
|
||||||
|
@ -821,7 +808,6 @@ end
|
||||||
--
|
--
|
||||||
-- @property gap
|
-- @property gap
|
||||||
-- @param number The value has to be greater than zero.
|
-- @param number The value has to be greater than zero.
|
||||||
-- @see tag.defaults.gap
|
|
||||||
-- @see gap_single_client
|
-- @see gap_single_client
|
||||||
|
|
||||||
function tag.object.set_gap(t, useless_gap)
|
function tag.object.set_gap(t, useless_gap)
|
||||||
|
@ -831,7 +817,9 @@ function tag.object.set_gap(t, useless_gap)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_gap(t)
|
function tag.object.get_gap(t)
|
||||||
return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or tag.defaults.gap
|
return tag.getproperty(t, "useless_gap")
|
||||||
|
or beautiful.useless_gap
|
||||||
|
or defaults.gap
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the spacing between clients
|
--- Set the spacing between clients
|
||||||
|
@ -870,7 +858,6 @@ end
|
||||||
--
|
--
|
||||||
-- @property gap_single_client
|
-- @property gap_single_client
|
||||||
-- @param boolean Enable gaps for a single client
|
-- @param boolean Enable gaps for a single client
|
||||||
-- @see tag.defaults.gap_single_client
|
|
||||||
|
|
||||||
function tag.object.set_gap_single_client(t, gap_single_client)
|
function tag.object.set_gap_single_client(t, gap_single_client)
|
||||||
tag.setproperty(t, "gap_single_client", gap_single_client == true)
|
tag.setproperty(t, "gap_single_client", gap_single_client == true)
|
||||||
|
@ -879,7 +866,7 @@ end
|
||||||
function tag.object.get_gap_single_client(t)
|
function tag.object.get_gap_single_client(t)
|
||||||
return tag.getproperty(t, "gap_single_client")
|
return tag.getproperty(t, "gap_single_client")
|
||||||
or beautiful.gap_single_client
|
or beautiful.gap_single_client
|
||||||
or tag.defaults.gap_single_client
|
or defaults.gap_single_client
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the spacing between clients.
|
--- Get the spacing between clients.
|
||||||
|
@ -913,10 +900,11 @@ end
|
||||||
--
|
--
|
||||||
-- @property master_fill_policy
|
-- @property master_fill_policy
|
||||||
-- @param string "expand" or "master_width_factor"
|
-- @param string "expand" or "master_width_factor"
|
||||||
-- @see tag.defaults.master_fill_policy
|
|
||||||
|
|
||||||
function tag.object.get_master_fill_policy(t)
|
function tag.object.get_master_fill_policy(t)
|
||||||
return tag.getproperty(t, "master_fill_policy") or beautiful.master_fill_policy or tag.defaults.master_fill_policy
|
return tag.getproperty(t, "master_fill_policy")
|
||||||
|
or beautiful.master_fill_policy
|
||||||
|
or defaults.master_fill_policy
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set size fill policy for the master client(s)
|
--- Set size fill policy for the master client(s)
|
||||||
|
@ -959,7 +947,9 @@ 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")
|
||||||
|
|
||||||
t = t or ascreen.focused().selected_tag
|
t = t or ascreen.focused().selected_tag
|
||||||
return tag.getproperty(t, "master_fill_policy") or beautiful.master_fill_policy or tag.defaults.master_fill_policy
|
return tag.getproperty(t, "master_fill_policy")
|
||||||
|
or beautiful.master_fill_policy
|
||||||
|
or defaults.master_fill_policy
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The default number of master windows.
|
--- The default number of master windows.
|
||||||
|
@ -977,7 +967,6 @@ end
|
||||||
--
|
--
|
||||||
-- @property master_count
|
-- @property master_count
|
||||||
-- @param integer nmaster Only positive values are accepted
|
-- @param integer nmaster Only positive values are accepted
|
||||||
-- @see tag.defaults.master_count
|
|
||||||
|
|
||||||
function tag.object.set_master_count(t, nmaster)
|
function tag.object.set_master_count(t, nmaster)
|
||||||
if nmaster >= 0 then
|
if nmaster >= 0 then
|
||||||
|
@ -987,7 +976,9 @@ function tag.object.set_master_count(t, nmaster)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_master_count(t)
|
function tag.object.get_master_count(t)
|
||||||
return tag.getproperty(t, "master_count") or beautiful.master_count or tag.defaults.master_count
|
return tag.getproperty(t, "master_count")
|
||||||
|
or beautiful.master_count
|
||||||
|
or defaults.master_count
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1090,7 +1081,6 @@ end
|
||||||
--
|
--
|
||||||
-- @property column_count
|
-- @property column_count
|
||||||
-- @tparam integer ncol Has to be greater than 1
|
-- @tparam integer ncol Has to be greater than 1
|
||||||
-- @see tag.defaults.column_count
|
|
||||||
|
|
||||||
function tag.object.set_column_count(t, ncol)
|
function tag.object.set_column_count(t, ncol)
|
||||||
if ncol >= 1 then
|
if ncol >= 1 then
|
||||||
|
@ -1100,7 +1090,9 @@ function tag.object.set_column_count(t, ncol)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tag.object.get_column_count(t)
|
function tag.object.get_column_count(t)
|
||||||
return tag.getproperty(t, "column_count") or beautiful.column_count or tag.defaults.column_count
|
return tag.getproperty(t, "column_count")
|
||||||
|
or beautiful.column_count
|
||||||
|
or defaults.column_count
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set number of column windows.
|
--- Set number of column windows.
|
||||||
|
|
Loading…
Reference in New Issue