From 7d5e80a8ee95d5f53a0d74bbd3d45d2bc0206a7e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 10 Apr 2016 11:12:31 +0200 Subject: [PATCH] Add awful.tag.find_by_name Signed-off-by: Uli Schlachter --- lib/awful/tag.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index b892f0af..a78a1023 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -420,6 +420,19 @@ function tag.gettags(s) return s and s.tags or {} 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. -- -- **Signal:**