Update tasklist text when client change
This commit is contained in:
parent
cbb39935db
commit
f7bdc9b75a
|
@ -59,6 +59,16 @@ local function reload_underlay(c)
|
||||||
end
|
end
|
||||||
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 function create_client_item(c,screen)
|
||||||
local cache = instances[screen].cache
|
local cache = instances[screen].cache
|
||||||
local menu = instances[screen].menu
|
local menu = instances[screen].menu
|
||||||
|
@ -107,7 +117,8 @@ local function new(screen)
|
||||||
local cache,menu = setmetatable({}, { __mode = 'k' }),radical.flexbar {
|
local cache,menu = setmetatable({}, { __mode = 'k' }),radical.flexbar {
|
||||||
select_on=radical.base.event.NEVER,
|
select_on=radical.base.event.NEVER,
|
||||||
fg = beautiful.fg_normal,
|
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
|
-- 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::sticky" , reload_underlay )
|
||||||
capi.client.connect_signal("property::ontop" , reload_underlay )
|
capi.client.connect_signal("property::ontop" , reload_underlay )
|
||||||
capi.client.connect_signal("property::floating", 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 })
|
return setmetatable(module, { __call = function(_, ...) return new(...) end })
|
||||||
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
||||||
|
|
|
@ -154,6 +154,14 @@ local function create_item(item,data,args)
|
||||||
wibox.widget.textbox.draw(self,w, cr, width, height)
|
wibox.widget.textbox.draw(self,w, cr, width, height)
|
||||||
end
|
end
|
||||||
tb:set_text(item.text)
|
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
|
-- Checkbox
|
||||||
local ck = module:setup_checked(item,data)
|
local ck = module:setup_checked(item,data)
|
||||||
|
|
|
@ -40,10 +40,8 @@ local function draw(data,item,args)
|
||||||
|
|
||||||
if flags[base.item_flags.SELECTED] or (item._tmp_menu) then
|
if flags[base.item_flags.SELECTED] or (item._tmp_menu) then
|
||||||
item.widget:set_bg(args.color or data.bg_focus)
|
item.widget:set_bg(args.color or data.bg_focus)
|
||||||
elseif #flags > 0 then
|
elseif flags[base.item_flags.HOVERED] then
|
||||||
if flags[base.item_flags.HOVERED] then
|
|
||||||
item.widget:set_bg(args.color or data.bg_hover)
|
item.widget:set_bg(args.color or data.bg_hover)
|
||||||
end
|
|
||||||
else
|
else
|
||||||
item.widget:set_bg(args.color or nil)
|
item.widget:set_bg(args.color or nil)
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,6 +98,7 @@ function module:setup_text(item,data,text_w)
|
||||||
else
|
else
|
||||||
text_w:set_markup(value)
|
text_w:set_markup(value)
|
||||||
end
|
end
|
||||||
|
item._private_data.text = value
|
||||||
if data.auto_resize then
|
if data.auto_resize then
|
||||||
local fit_w,fit_h = wibox.widget.textbox.fit(text_w,9999,9999)
|
local fit_w,fit_h = wibox.widget.textbox.fit(text_w,9999,9999)
|
||||||
local is_largest = item == data._internal.largest_item_w
|
local is_largest = item == data._internal.largest_item_w
|
||||||
|
|
Loading…
Reference in New Issue