Add a more reliable (but hacky) tag tracking system
This commit is contained in:
parent
02865234a1
commit
dbf1865055
|
@ -15,6 +15,7 @@ local client = require( "awful.client" )
|
||||||
local wibox = require( "wibox" )
|
local wibox = require( "wibox" )
|
||||||
local awful = require( "awful" )
|
local awful = require( "awful" )
|
||||||
local theme = require( "radical.theme")
|
local theme = require( "radical.theme")
|
||||||
|
local tracker = require( "radical.impl.taglist.tracker" )
|
||||||
|
|
||||||
local CLONED = 100
|
local CLONED = 100
|
||||||
|
|
||||||
|
@ -176,6 +177,8 @@ end
|
||||||
|
|
||||||
local function new(s)
|
local function new(s)
|
||||||
|
|
||||||
|
local track = tracker(s)
|
||||||
|
|
||||||
local args = {
|
local args = {
|
||||||
item_style = radical.item.style.arrow_prefix,
|
item_style = radical.item.style.arrow_prefix,
|
||||||
select_on = radical.base.event.NEVER,
|
select_on = radical.base.event.NEVER,
|
||||||
|
@ -208,17 +211,19 @@ local function new(s)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
track:reload()
|
||||||
return instances[s]
|
return instances[s]
|
||||||
end
|
end
|
||||||
|
|
||||||
capi.tag.connect_signal("property::selected" , select)
|
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
|
if t then
|
||||||
local s = tag.getscreen(t)
|
local s = tag.getscreen(t)
|
||||||
local item = cache[t]
|
local item = cache[t]
|
||||||
if item then
|
if item then
|
||||||
local index = tag.getidx(t)
|
local index = tag.getidx(t)
|
||||||
-- instances[s]:move(item,index)
|
instances[s]:move(item,index)
|
||||||
item.tw:set_markup(" <b>"..(index).."</b> ")
|
item.tw:set_markup(" <b>"..(index).."</b> ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ local client_menu = require("radical.impl.tasklist.client_menu")
|
||||||
local theme = require( "radical.theme")
|
local theme = require( "radical.theme")
|
||||||
|
|
||||||
local sticky,urgent,instances,module = {},{},{},{}
|
local sticky,urgent,instances,module = {},{},{},{}
|
||||||
local _cache = {}
|
local _cache = setmetatable({}, { __mode = 'k' })
|
||||||
local MINIMIZED = 101
|
local MINIMIZED = 101
|
||||||
theme.register_color(MINIMIZED , "minimized" , "tasklist_minimized" , true )
|
theme.register_color(MINIMIZED , "minimized" , "tasklist_minimized" , true )
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ local function new(screen)
|
||||||
args["fg_"..v] = beautiful["tasklist_fg_"..v]
|
args["fg_"..v] = beautiful["tasklist_fg_"..v]
|
||||||
args["underlay_bg_"..v] = beautiful["tasklist_underlay_bg_"..v]
|
args["underlay_bg_"..v] = beautiful["tasklist_underlay_bg_"..v]
|
||||||
end
|
end
|
||||||
local cache,menu = setmetatable({}, { __mode = 'k' }),radical.flexbar(args)
|
local menu = radical.flexbar(args)
|
||||||
-- overlay = function(data,item,cd,w,h)
|
-- overlay = function(data,item,cd,w,h)
|
||||||
-- print("foo!")
|
-- print("foo!")
|
||||||
-- end,
|
-- end,
|
||||||
|
@ -227,7 +227,7 @@ local function new(screen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function untagged(c,t)
|
local function untagged(c,t)
|
||||||
local item = cache[c]
|
local item = _cache[c]
|
||||||
if t.selected and tag.getscreen(t) == screen then
|
if t.selected and tag.getscreen(t) == screen then
|
||||||
menu:remove(item)
|
menu:remove(item)
|
||||||
end
|
end
|
||||||
|
@ -240,7 +240,7 @@ local function new(screen)
|
||||||
capi.client.connect_signal("tagged" , tagged )
|
capi.client.connect_signal("tagged" , tagged )
|
||||||
capi.client.connect_signal("untagged" , untagged )
|
capi.client.connect_signal("untagged" , untagged )
|
||||||
|
|
||||||
instances[screen] = {menu = menu, cache = cache }
|
instances[screen] = {menu = menu}
|
||||||
|
|
||||||
load_clients(tag.selected(screen))
|
load_clients(tag.selected(screen))
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ local function new_item(data,args)
|
||||||
data._tmp_menu = nil
|
data._tmp_menu = nil
|
||||||
end
|
end
|
||||||
data.item_style(current_item,{})
|
data.item_style(current_item,{})
|
||||||
current_item.selected = false
|
-- current_item.selected = false
|
||||||
end
|
end
|
||||||
if data.sub_menu_on == module.event.SELECTED and current_item ~= item then
|
if data.sub_menu_on == module.event.SELECTED and current_item ~= item then
|
||||||
module.execute_sub_menu(data,item)
|
module.execute_sub_menu(data,item)
|
||||||
|
|
Loading…
Reference in New Issue