local nametag_format = "%s: %s" function nametag(t, name) -- set tag basename if t.basename == nil then t.basename = t.name end if name == nil then t.name = t.basename return end t.name = string.format(nametag_format, t.basename, name) end function nametagc_t(t, c) local cs = t.screen:get_all_clients(true) if c then table.insert(cs, c) end for _, c in ipairs(cs) do for _, ct in ipairs(c:tags()) do if ct == t then nametag(t, c.class) return end end end nametag(t) end -- without client function nametagc_t_u(t) nametagc_t(t) end function nametagc_c(c) for _, ct in ipairs(c:tags()) do nametagc_t(ct, c) end end tag.connect_signal("tagged", nametagc_t) tag.connect_signal("untagged", nametagc_t_u) client.connect_signal("raised", nametagc_c) client.connect_signal("property::class", nametagc_c)