add("name", {properties}) allows creation of tags by passing a string and table of properties to set for the tag. this is intended to be a convenient way to make tags as opposed to the rather spartan way allowed by calling awful.tag.new({"","",...}, screen, layout) --- lib/awful/tag.lua.in | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index a984ed5..4496fcf 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -10,6 +10,7 @@ local pairs = pairs local ipairs = ipairs local table = table local setmetatable = setmetatable +local unpack = unpack local capi = { tag = tag, @@ -30,6 +31,30 @@ data.tags = setmetatable({}, { __mode = 'k' }) history = {} history.limit = 20 +--- Add a tag +-- @param name The tag name, a string +-- @param properties The tags properties, a table +-- @return The created tag +function add(name, properties) + local newtag = unpack(new({name}, + properties.screen or 1, + properties.layout or nil)) + + -- no reason to re-set these in the loop below + properties.screen = nil + properties.layout = nil + + -- some limitations here, method values can't be set? + -- awful.rules could be generalized to apply to tag objects too.. + if newtag ~= nil then + for k, v in pairs(properties) do + setproperty(newtag, k, v) + end + end + + return newtag +end + --- Create a set of tags and attach it to a screen. -- @param names The tag name, in a table -- @param screen The tag screen, or 1 if not set. -- 1.7.0.1 -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.