Update tasklist text when client change

This commit is contained in:
Emmanuel Lepage Vallee 2014-02-09 03:04:02 -05:00
parent cbb39935db
commit f7bdc9b75a
4 changed files with 25 additions and 5 deletions

View File

@ -59,6 +59,16 @@ local function reload_underlay(c)
end
end
-- Reload title and icon
local function reload_content(c,b,a)
local cache = instances[c.screen].cache
local item = cache[c]
if item then
item.text = c.name
item.icon = c.icon
end
end
local function create_client_item(c,screen)
local cache = instances[screen].cache
local menu = instances[screen].menu
@ -107,7 +117,8 @@ local function new(screen)
local cache,menu = setmetatable({}, { __mode = 'k' }),radical.flexbar {
select_on=radical.base.event.NEVER,
fg = beautiful.fg_normal,
bg_focus = beautiful.taglist_bg_image_selected2 or beautiful.bg_focus
bg_focus = beautiful.taglist_bg_image_selected2 or beautiful.bg_focus,
bg_hover = beautiful.menu_bg_focus
}
-- Clear the menu and repopulate it
@ -161,6 +172,8 @@ capi.client.connect_signal("unfocus" , unfocus )
capi.client.connect_signal("property::sticky" , reload_underlay )
capi.client.connect_signal("property::ontop" , reload_underlay )
capi.client.connect_signal("property::floating", reload_underlay )
capi.client.connect_signal("property::name" , reload_content )
capi.client.connect_signal("property::icon" , reload_content )
return setmetatable(module, { __call = function(_, ...) return new(...) end })
-- kate: space-indent on; indent-width 2; replace-tabs on;

View File

@ -154,6 +154,14 @@ local function create_item(item,data,args)
wibox.widget.textbox.draw(self,w, cr, width, height)
end
tb:set_text(item.text)
item._internal.set_map.text = function (value)
if data.disable_markup then
tb:set_text(value)
else
tb:set_markup(value)
end
item._private_data.text = value
end
-- Checkbox
local ck = module:setup_checked(item,data)

View File

@ -40,10 +40,8 @@ local function draw(data,item,args)
if flags[base.item_flags.SELECTED] or (item._tmp_menu) then
item.widget:set_bg(args.color or data.bg_focus)
elseif #flags > 0 then
if flags[base.item_flags.HOVERED] then
item.widget:set_bg(args.color or data.bg_hover)
end
elseif flags[base.item_flags.HOVERED] then
item.widget:set_bg(args.color or data.bg_hover)
else
item.widget:set_bg(args.color or nil)
end

View File

@ -98,6 +98,7 @@ function module:setup_text(item,data,text_w)
else
text_w:set_markup(value)
end
item._private_data.text = value
if data.auto_resize then
local fit_w,fit_h = wibox.widget.textbox.fit(text_w,9999,9999)
local is_largest = item == data._internal.largest_item_w