Skip to content

Commit

Permalink
fixed icon_taglist and text_taglist spamming errors for no reason (fo…
Browse files Browse the repository at this point in the history
…r real this time)
  • Loading branch information
elenapan committed May 4, 2019
1 parent 3e130fc commit db715da
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 9 deletions.
28 changes: 23 additions & 5 deletions config/awesome/noodle/icon_taglist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 35 additions & 4 deletions config/awesome/noodle/text_taglist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,55 @@ 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
if s.tags[i] then
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)
Expand Down

0 comments on commit db715da

Please sign in to comment.