Fix an issue with :remove() and fix taglist signals

This commit is contained in:
Emmanuel Lepage Vallee 2014-02-11 21:38:05 -05:00
parent 76c3195dbd
commit 76623695e6
4 changed files with 45 additions and 13 deletions

View File

@ -534,7 +534,7 @@ local function new(args)
function data:append(item)
if not item then return end
internal.items[#internal.items + 1] = item
internal.items[#internal.items + 1] = {item}
data:emit_signal("item::appended",item)
end

View File

@ -51,7 +51,15 @@ local function track_used(c,t)
end
end
local function tag_added(t)
local function tag_activated(t)
local act = t.activated
if not act and cache[t] then
instances[cache[t]._internal.screen]:remove(cache[t])
cache[t] = nil
end
end
local function tag_added(t,b)
if t then
local s = tag.getscreen(t)
if not cache[t] then
@ -64,6 +72,32 @@ local function tag_added(t)
end
end
local is_init = false
local function init()
if is_init then return end
-- Global signals
capi.client.connect_signal("tagged", track_used)
capi.client.connect_signal("untagged", track_used)
capi.client.connect_signal("unmanage", track_used)
capi.tag.connect_signal("property::activated",tag_activated)
capi.tag.connect_signal("property::screen", tag_added)
-- Property bindings
capi.tag.connect_signal("property::name", function(t)
local item = cache[t]
if item then
item.text = t.name
end
end)
capi.tag.connect_signal("property::icon", function(t)
local item = cache[t]
if item then
item.icon = tag.geticon(t)
end
end)
end
local function new(s)
instances[s] = radical.bar {
select_on = radical.base.event.NEVER,
@ -80,21 +114,15 @@ local function new(s)
end
-- Per screen signals
tag.attached_connect_signal(screen, "property::selected", tag_added)
-- tag.attached_connect_signal(screen, "property::icon", ut)
-- tag.attached_connect_signal(s, "property::selected", tag_added)
-- tag.attached_connect_signal(screen, "property::hide", ut)
-- tag.attached_connect_signal(screen, "property::name", ut)
tag.attached_connect_signal(screen, "property::activated", tag_added)
tag.attached_connect_signal(screen, "property::screen", tag_added)
tag.attached_connect_signal(screen, "property::index", tag_added)
-- tag.attached_connect_signal(s, "property::activated", tag_added)
-- tag.attached_connect_signal(s, "property::index", tag_added)
init()
return instances[s]
end
-- Global signals
capi.client.connect_signal("tagged", track_used)
capi.client.connect_signal("untagged", track_used)
capi.client.connect_signal("unmanage", track_used)
return setmetatable(module, { __call = function(_, ...) return new(...) end })
-- kate: space-indent on; indent-width 2; replace-tabs on;

View File

@ -118,7 +118,8 @@ local function new(screen)
select_on=radical.base.event.NEVER,
fg = beautiful.fg_normal,
bg_focus = beautiful.taglist_bg_image_selected2 or beautiful.bg_focus,
bg_hover = beautiful.menu_bg_focus
bg_hover = beautiful.menu_bg_focus,
disable_markup = true
}
-- Clear the menu and repopulate it

View File

@ -119,6 +119,9 @@ function module:setup_text(item,data,text_w)
end
function module:setup_item(data,item,args)
if not base then
base = require( "radical.base" )
end
--Create the background
local item_layout = item.item_layout or horizontal_item_layout
item.widget = item_layout(item,data,args)--wibox.widget.background()