126 lines
3.1 KiB
Lua
Executable File
126 lines
3.1 KiB
Lua
Executable File
local tasklist = {}
|
|
|
|
--[[ Create a tasklist widget
|
|
s.mytasklist = awful.widget.tasklist {
|
|
screen = s,
|
|
filter = awful.widget.tasklist.filter.currenttags,
|
|
buttons = tasklist_buttons
|
|
} ]]--
|
|
|
|
local buttons = gears.table.join(
|
|
awful.button( {}, 1,
|
|
function (c)
|
|
if c == client.focus then
|
|
c.minimized = true
|
|
else
|
|
c:emit_signal(
|
|
"request::activate",
|
|
"tasklist",
|
|
{raise = true}
|
|
)
|
|
end
|
|
end
|
|
)
|
|
)
|
|
|
|
|
|
tasklist.make = function(screen)
|
|
return awful.widget.tasklist({
|
|
screen = screen,
|
|
filter = awful.widget.tasklist.filter.currenttags,
|
|
buttons = buttons,
|
|
layout = {
|
|
spacing_widget = {
|
|
{
|
|
forced_width = beautiful.dpi(2),
|
|
forced_height = beautiful.dpi(12),
|
|
thickness = beautiful.dpi(1),
|
|
color = "#000000FF", --beautiful.color.bar.spacer,
|
|
widget = wibox.widget.separator
|
|
},
|
|
valign = "center",
|
|
halign = "center",
|
|
widget = wibox.container.place,
|
|
},
|
|
spacing = 1,
|
|
layout = wibox.layout.fixed.horizontal
|
|
},
|
|
|
|
-- Notice that there is *NO* wibox.wibox prefix, it is a template,
|
|
-- not a widget instance.
|
|
widget_template = {
|
|
{
|
|
wibox.widget.base.make_widget(),
|
|
forced_height = beautiful.dpi(3),
|
|
id = "top_tab",
|
|
widget = wibox.container.background,
|
|
},
|
|
{
|
|
{
|
|
{
|
|
widget = wibox.container.place,
|
|
halign = "center",
|
|
valign = "bottom",
|
|
fill_vertical = true,
|
|
{
|
|
id = "clienticon",
|
|
widget = awful.widget.clienticon,
|
|
},
|
|
},
|
|
margins = beautiful.dpi(3),
|
|
widget = wibox.container.margin
|
|
},
|
|
id = "background",
|
|
widget = wibox.container.background,
|
|
},
|
|
nil,
|
|
|
|
|
|
-- The create callback is only called once, when the task indicator
|
|
-- is created.
|
|
create_callback = function(self, c, index, objects)
|
|
-- Set indicator icon
|
|
self:get_children_by_id("clienticon")[1].client = c
|
|
|
|
-- Change background when mouse is over widget
|
|
self:connect_signal("mouse::enter", function(result)
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA"
|
|
self:get_children_by_id("background")[1].bg = beautiful.color.bar.hover_bg
|
|
|
|
end)
|
|
|
|
self:connect_signal("mouse::leave", function(result)
|
|
self:get_children_by_id("background")[1].bg = beautiful.color.transparent
|
|
|
|
if c == client.focus then
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0FF"
|
|
elseif c.minimized then
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77"
|
|
else
|
|
self:get_children_by_id("top_tab")[1].bg = beautiful.color.bar.hover_bg --beautiful.color.transparent
|
|
end
|
|
end)
|
|
end,
|
|
|
|
-- The update callback is called every time the icon needs updating.
|
|
update_callback = function(self, c, index, objects)
|
|
|
|
-- Update indicator icon
|
|
self:get_children_by_id("clienticon")[1].client = c
|
|
|
|
-- Update top color
|
|
if c == client.focus then
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA"
|
|
elseif c.minimized then
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77"
|
|
else
|
|
self:get_children_by_id("top_tab")[1].bg = beautiful.color.bar.hover_bg --beautiful.color.transparent
|
|
end
|
|
end,
|
|
layout = wibox.layout.align.vertical,
|
|
},
|
|
})
|
|
end
|
|
|
|
return tasklist.make
|