Add a more reliable (but hacky) tag tracking system

This commit is contained in:
Emmanuel Lepage Vallee 2014-03-20 22:50:06 -04:00
parent 02865234a1
commit dbf1865055
3 changed files with 12 additions and 7 deletions

View File

@ -15,6 +15,7 @@ local client = require( "awful.client" )
local wibox = require( "wibox" )
local awful = require( "awful" )
local theme = require( "radical.theme")
local tracker = require( "radical.impl.taglist.tracker" )
local CLONED = 100
@ -176,6 +177,8 @@ end
local function new(s)
local track = tracker(s)
local args = {
item_style = radical.item.style.arrow_prefix,
select_on = radical.base.event.NEVER,
@ -208,17 +211,19 @@ local function new(s)
end)
init()
track:reload()
return instances[s]
end
capi.tag.connect_signal("property::selected" , select)
capi.tag.connect_signal("property::index",function(t,i)
capi.tag.connect_signal("property::index2",function(t,i)
print("FOO",t,i)
if t then
local s = tag.getscreen(t)
local item = cache[t]
if item then
local index = tag.getidx(t)
-- instances[s]:move(item,index)
instances[s]:move(item,index)
item.tw:set_markup(" <b>"..(index).."</b> ")
end
end

View File

@ -17,7 +17,7 @@ local client_menu = require("radical.impl.tasklist.client_menu")
local theme = require( "radical.theme")
local sticky,urgent,instances,module = {},{},{},{}
local _cache = {}
local _cache = setmetatable({}, { __mode = 'k' })
local MINIMIZED = 101
theme.register_color(MINIMIZED , "minimized" , "tasklist_minimized" , true )
@ -213,7 +213,7 @@ local function new(screen)
args["fg_"..v] = beautiful["tasklist_fg_"..v]
args["underlay_bg_"..v] = beautiful["tasklist_underlay_bg_"..v]
end
local cache,menu = setmetatable({}, { __mode = 'k' }),radical.flexbar(args)
local menu = radical.flexbar(args)
-- overlay = function(data,item,cd,w,h)
-- print("foo!")
-- end,
@ -227,7 +227,7 @@ local function new(screen)
end
end
local function untagged(c,t)
local item = cache[c]
local item = _cache[c]
if t.selected and tag.getscreen(t) == screen then
menu:remove(item)
end
@ -240,7 +240,7 @@ local function new(screen)
capi.client.connect_signal("tagged" , tagged )
capi.client.connect_signal("untagged" , untagged )
instances[screen] = {menu = menu, cache = cache }
instances[screen] = {menu = menu}
load_clients(tag.selected(screen))

View File

@ -151,7 +151,7 @@ local function new_item(data,args)
data._tmp_menu = nil
end
data.item_style(current_item,{})
current_item.selected = false
-- current_item.selected = false
end
if data.sub_menu_on == module.event.SELECTED and current_item ~= item then
module.execute_sub_menu(data,item)