From f7bdc9b75a85318bc9591970d78ae1cf60c9a5e3 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 9 Feb 2014 03:04:02 -0500 Subject: [PATCH] Update tasklist text when client change --- impl/tasklist/init.lua | 15 ++++++++++++++- item_layout/horizontal.lua | 8 ++++++++ item_style/arrow_single.lua | 6 ++---- layout/vertical.lua | 1 + 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/impl/tasklist/init.lua b/impl/tasklist/init.lua index faa99e2..75615a5 100644 --- a/impl/tasklist/init.lua +++ b/impl/tasklist/init.lua @@ -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; diff --git a/item_layout/horizontal.lua b/item_layout/horizontal.lua index cb57c1d..e77540d 100644 --- a/item_layout/horizontal.lua +++ b/item_layout/horizontal.lua @@ -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) diff --git a/item_style/arrow_single.lua b/item_style/arrow_single.lua index ec1d64d..02a8262 100644 --- a/item_style/arrow_single.lua +++ b/item_style/arrow_single.lua @@ -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 diff --git a/layout/vertical.lua b/layout/vertical.lua index b1177e2..1d05806 100644 --- a/layout/vertical.lua +++ b/layout/vertical.lua @@ -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