mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-07 17:27:33 +08:00
fixed icon_taglist and text_taglist spamming errors for no reason (for real this time)
This commit is contained in:
parent
3e130fc6cf
commit
db715dacee
2 changed files with 58 additions and 9 deletions
|
|
@ -59,21 +59,39 @@ gears.table.join(
|
|||
end)
|
||||
))
|
||||
|
||||
|
||||
-- Shorter names (eg. f = focused) to save space
|
||||
local f, u, o, e;
|
||||
-- Set fallback values if needed
|
||||
if beautiful.taglist_icons_focused then
|
||||
f = beautiful.taglist_icons_focused
|
||||
u = beautiful.taglist_icons_urgent
|
||||
o = beautiful.taglist_icons_occupied
|
||||
e = beautiful.taglist_icons_empty
|
||||
else
|
||||
-- Fallback values (very useless ones though)
|
||||
local i = beautiful.awesome_icon
|
||||
f = {i, i, i, i, i, i, i, i, i, i}
|
||||
u = f
|
||||
o = f
|
||||
e = f
|
||||
end
|
||||
|
||||
|
||||
local function update_widget()
|
||||
for i = 1, ntags do
|
||||
local tag_clients
|
||||
if s.tags[i] then
|
||||
tag_clients = s.tags[i]:clients()
|
||||
end
|
||||
|
||||
if s.tags[i] and s.tags[i].selected then
|
||||
tag_icons[i].image = beautiful.taglist_icons_focused[i] or beautiful.awesome_icon
|
||||
tag_icons[i].image = f[i]
|
||||
elseif s.tags[i] and s.tags[i].urgent then
|
||||
tag_icons[i].image = beautiful.taglist_icons_urgent[i] or beautiful.awesome_icon
|
||||
tag_icons[i].image = u[i]
|
||||
elseif tag_clients and #tag_clients > 0 then
|
||||
tag_icons[i].image = beautiful.taglist_icons_occupied[i] or beautiful.awesome_icon
|
||||
tag_icons[i].image = o[i]
|
||||
else
|
||||
tag_icons[i].image = beautiful.taglist_icons_empty[i] or beautiful.awesome_icon
|
||||
tag_icons[i].image = e[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -73,6 +73,36 @@ gears.table.join(
|
|||
end)
|
||||
))
|
||||
|
||||
-- Shorter names (eg. tf = text_focused) to save space
|
||||
local tf, tu, to, te, tcf, tcu, tco, tce;
|
||||
-- Set fallback values if needed
|
||||
if beautiful.taglist_text_focused then
|
||||
tf = beautiful.taglist_text_focused
|
||||
tu = beautiful.taglist_text_urgent
|
||||
to = beautiful.taglist_text_occupied
|
||||
te = beautiful.taglist_text_empty
|
||||
cf = beautiful.taglist_text_color_focused
|
||||
cu = beautiful.taglist_text_color_urgent
|
||||
co = beautiful.taglist_text_color_occupied
|
||||
ce = beautiful.taglist_text_color_empty
|
||||
else
|
||||
-- Fallback values
|
||||
tf = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
|
||||
tu = tf
|
||||
to = tf
|
||||
te = tf
|
||||
|
||||
local ff = beautiful.fg_focus
|
||||
local fu = beautiful.fg_urgent
|
||||
local fo = beautiful.fg_normal
|
||||
local fe = beautiful.fg_minimize
|
||||
|
||||
cf = {ff, ff, ff, ff, ff, ff, ff, ff, ff, ff}
|
||||
cu = {fu, fu, fu, fu, fu, fu, fu, fu, fu, fu}
|
||||
co = {fo, fo, fo, fo, fo, fo, fo, fo, fo, fo}
|
||||
ce = {fe, fe, fe, fe, fe, fe, fe, fe, fe, fe}
|
||||
end
|
||||
|
||||
local function update_widget()
|
||||
for i = 1, ntags do
|
||||
local tag_clients
|
||||
|
|
@ -80,17 +110,18 @@ local function update_widget()
|
|||
tag_clients = s.tags[i]:clients()
|
||||
end
|
||||
if s.tags[i] and s.tags[i].selected then
|
||||
tag_text[i].markup = helpers.colorize_text(beautiful.taglist_text_focused[i] or tostring(i), beautiful.taglist_text_color_focused[i] or beautiful.fg_focus)
|
||||
tag_text[i].markup = helpers.colorize_text(tf[i], cf[i])
|
||||
elseif s.tags[i] and s.tags[i].urgent then
|
||||
tag_text[i].markup = helpers.colorize_text(beautiful.taglist_text_urgent[i] or tostring(i), beautiful.taglist_text_color_urgent[i] or beautiful.fg_urgent)
|
||||
tag_text[i].markup = helpers.colorize_text(tu[i], cu[i])
|
||||
elseif tag_clients and #tag_clients > 0 then
|
||||
tag_text[i].markup = helpers.colorize_text(beautiful.taglist_text_occupied[i] or tostring(i), beautiful.taglist_text_color_occupied[i] or beautiful.fg_normal)
|
||||
tag_text[i].markup = helpers.colorize_text(to[i], co[i])
|
||||
else
|
||||
tag_text[i].markup = helpers.colorize_text(beautiful.taglist_text_empty[i] or tostring(i), beautiful.taglist_text_color_empty[i] or beautiful.fg_minimize)
|
||||
tag_text[i].markup = helpers.colorize_text(te[i], ce[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
client.connect_signal("unmanage", function(c)
|
||||
update_widget()
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue