[PATCH] Added a small function to ask for a tag's display name.

1 view
Skip to first unread message

dcurtis

unread,
Mar 5, 2009, 4:46:52 PM3/5/09
to wmii...@googlegroups.com

I added a small function called 'tag_display' that generates the tag name. By
default this is blank. However, from my personal wmiirc file I redefine it as
a function that wraps the current tag in "<" and ">". It's a stupid style
thing but I got used to it. It may be too pointless and stupid to include but
here it is nonetheless.

dcurtis

unread,
Mar 5, 2009, 4:46:53 PM3/5/09
to wmii...@googlegroups.com, Donald E Curtis
From: Donald E Curtis <dcu...@l-lnx107.divms.uiowa.edu>

---
core/wmii.lua | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/core/wmii.lua b/core/wmii.lua
index a295f0e..2f01458 100644
--- a/core/wmii.lua
+++ b/core/wmii.lua
@@ -1027,6 +1027,10 @@ function update_displayed_tags ()
end
end

+function tag_display(tag, selected)
+ return tag
+end
+
function update_displayed_tags_on_screen(s)
local lbar = "/lbar"
if s then
@@ -1055,9 +1059,9 @@ function update_displayed_tags_on_screen(s)
color = fc
end
if not old[v] then
- create (lbar .. "/" .. v, color .. " " .. v)
+ create (lbar .. "/" .. v, color .. " " .. tag_display(v,selected))
end
- write (lbar .. "/" .. v, color .. " " .. v)
+ write (lbar .. "/" .. v, color .. " " .. tag_display(v,selected))
old[v] = nil
end

@@ -1084,7 +1088,7 @@ function create_tag_widget(name)
end
local i, s
for i,s in pairs(screens) do
- create ("/screen/"..s.."/lbar/" .. name, nc .. " " .. name)
+ create ("/screen/"..s.."/lbar/" .. name, nc .. " " .. tag_display(name))
end
end

@@ -1231,8 +1235,8 @@ local ev_handlers = {
local fc = get_screen_ctl(scrn, "focuscolors") or get_ctl("focuscolors") or ""
log ("# echo " .. fc .. " " .. tag .. " | wmiir write " .. file)

- create (file, fc .. " " .. tag)
- write (file, fc .. " " .. tag)
+ create (file, fc .. " " .. tag_display(tag,true))
+ write (file, fc .. " " .. tag_display(tag,true))
end,
UnfocusTag = function (ev, arg)
log ("UnfocusTag: " .. arg)
@@ -1250,8 +1254,8 @@ local ev_handlers = {
local nc = get_screen_ctl(scrn, "normcolors") or get_ctl("normcolors") or ""
log ("# echo " .. nc .. " " .. tag .. " | wmiir write " .. file)

- create (file, nc .. " " .. tag)
- write (file, nc .. " " .. tag)
+ create (file, nc .. " " .. tag_display(tag,false))
+ write (file, nc .. " " .. tag_display(tag,false))

-- don't duplicate the last entry
if not (tag == view_hist[#view_hist]) then
--
1.5.5.1

Bart Trojanowski

unread,
Mar 17, 2009, 10:13:32 PM3/17/09
to wmii...@googlegroups.com, Donald E Curtis
* dcurtis <dcu...@cs.uiowa.edu> [090305 15:46]:

I think there are a few places where the tag_display() could be store in
a local variable since it's used several times, but besides that it's
good.

-Bart

--
WebSig: http://www.jukie.net/~bart/sig/

Reply all
Reply to author
Forward
0 new messages