Add awful.tag.find_by_name

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-10 11:12:31 +02:00 committed by Uli Schlachter
parent 53bebfde02
commit 7d5e80a8ee
1 changed files with 13 additions and 0 deletions

View File

@ -420,6 +420,19 @@ function tag.gettags(s)
return s and s.tags or {} return s and s.tags or {}
end end
--- Find a tag by name
-- @tparam[opt] screen s The screen of the tag
-- @tparam string name The name of the tag
-- @return The tag found, or `nil`
function tag.find_by_name(s, name)
local tags = s and s.tags or root.tags()
for _, t in ipairs(tags) do
if name == t.name then
return t
end
end
end
--- The tag screen. --- The tag screen.
-- --
-- **Signal:** -- **Signal:**