--- lib/awful/tag.lua.in | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 4496fcf..dfa78f8 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -11,6 +11,7 @@ local ipairs = ipairs local table = table local setmetatable = setmetatable local unpack = unpack +local prompt = require("awful.prompt") local capi = { tag = tag, @@ -75,6 +76,37 @@ function new(names, screen, layout) return tags end +--- Rename a tag +-- @param target_tag The tag to rename, [selected()] +-- @param name Optional new name, a string [selected().name] +-- @param tb Optional textbox widget to display prompt in, [selected().textbox] +-- @param args Table of options to pass through to awful.prompt.run +function rename(target_tag, name, tb, args) + local target_tag = target_tag or selected() + local args = args or {} + + prompt.run({fg_cursor = args.fg_cursor or "#ff3335", + bg_cursor = args.bg_cursor or "#222222", + ul_cursor = args.ul_cursor or "single", + selectall = args.selectall or true, + text = name or target_tag.name}, + tb or getproperty(target_tag, "textbox"), + function(new_name) + if not new_name or #new_name == 0 then + return + else + target_tag.name = new_name + end + end, + nil, nil, nil, + function() + target_tag:emit_signal("property::name") + end + ) + + return target_tag.name +end + --- Update the tag history. -- @param obj Screen object. function history.update(obj) -- 1.7.0.1 -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.