Implement tag menu highlight (issue #22)

This commit is contained in:
Emmanuel Lepage Vallee 2014-03-28 01:25:09 -04:00
parent 5efc2d89e0
commit f461d0316a
2 changed files with 33 additions and 3 deletions

View File

@ -3,6 +3,7 @@ local capi = { screen = screen, client=client}
local awful = require( "awful" )
local beautiful = require("beautiful")
local suits = require("awful.layout.suit")
local tag_list = nil
local module = {}
@ -22,10 +23,21 @@ local fallback_layouts = {
}
local function createTagList(aScreen)
if not tag_list then
tag_list = require("radical.impl.taglist")
end
local tagList = radical.context({autodiscard = true})
for _, v in ipairs(awful.tag.gettags(aScreen)) do
tagList:add_item({text = v.name,icon=awful.tag.geticon(v)})
local i = tagList:add_item({text = v.name,icon=awful.tag.geticon(v)})
i:connect_signal("mouse::enter",function()
tag_list.highlight(v)
end)
end
tagList:connect_signal("visible::changed",function()
if not tagList.visible then
tag_list.highlight(nil)
end
end)
return tagList
end

View File

@ -19,8 +19,10 @@ local tracker = require( "radical.impl.taglist.tracker" )
local tag_menu = require( "radical.impl.taglist.tag_menu" )
local CLONED = 100
local HIGHLIGHTED = -2
theme.register_color(CLONED , "cloned" , "taglist_cloned" , true )
theme.register_color(CLONED , "cloned" , "cloned" , true )
theme.register_color(HIGHLIGHTED , "highlight" , "highlight" , true )
local module,instances = {},{}
@ -177,6 +179,21 @@ local function init()
is_init = true
end
local highlighted = nil
function module.highlight(t)
if highlighted and highlighted ~= t then
highlighted.state[HIGHLIGHTED] = nil
highlighted = nil
end
if t then
local item = cache[t]
if item then
highlighted = item
highlighted.state[HIGHLIGHTED] = true
end
end
end
local function new(s)
local track = tracker(s)
@ -190,10 +207,11 @@ local function new(s)
fg_focus = beautiful.taglist_fg_selected,
-- fkeys_prefix = true,
}
for k,v in ipairs {"hover","used","urgent","cloned","changed"} do
for k,v in ipairs {"hover","used","urgent","cloned","changed","highlight"} do
args["bg_"..v] = beautiful["taglist_bg_"..v]
args["fg_"..v] = beautiful["taglist_fg_"..v]
end
print("THAT",beautiful.taglist_bg_highlight)
instances[s] = radical.bar(args)