2021-08-01 07:24:26 -07:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
2022-04-24 13:38:27 -07:00
|
|
|
widget = wibox.container.place,
|
|
|
|
halign = "center",
|
|
|
|
valign = "bottom",
|
|
|
|
fill_vertical = true,
|
|
|
|
{
|
|
|
|
id = "clienticon",
|
2023-09-03 09:26:07 -07:00
|
|
|
-- Don't use awesomewm's stock clienticon.
|
|
|
|
-- using a raw imagebox lets us handle nil icons...
|
|
|
|
-- also, see th call to awesome.preferred_icon_size in rc.lua.
|
|
|
|
widget = wibox.widget.imagebox,
|
2022-04-24 13:38:27 -07:00
|
|
|
},
|
2021-08-01 07:24:26 -07:00
|
|
|
},
|
|
|
|
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)
|
2023-09-03 09:26:07 -07:00
|
|
|
|
2021-08-01 07:24:26 -07:00
|
|
|
-- Set indicator icon
|
2023-09-03 09:26:07 -07:00
|
|
|
if c.icon == nil then
|
|
|
|
self:get_children_by_id("clienticon")[1].image = beautiful.icons[config.core.default_clienticon]
|
|
|
|
else
|
|
|
|
self:get_children_by_id("clienticon")[1].image = c.icon
|
|
|
|
end
|
|
|
|
self:get_children_by_id("clienticon")[1]:emit_signal("widget::redraw_needed")
|
|
|
|
|
|
|
|
|
|
|
|
-- 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 = beautiful.color.bar.hover_bg --beautiful.color.transparent
|
|
|
|
else
|
|
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77"
|
|
|
|
end
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
-- Change background when mouse is over widget
|
|
|
|
self:connect_signal("mouse::enter", function(result)
|
2022-04-24 13:40:49 -07:00
|
|
|
--self:get_children_by_id("top_tab")[1].bg = "#2DA0DA"
|
2021-08-01 07:24:26 -07:00
|
|
|
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
|
2021-08-01 08:05:19 -07:00
|
|
|
self:get_children_by_id("top_tab")[1].bg = beautiful.color.bar.hover_bg --beautiful.color.transparent
|
2022-04-24 13:40:49 -07:00
|
|
|
else
|
|
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77"
|
2021-08-01 07:24:26 -07:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- The update callback is called every time the icon needs updating.
|
|
|
|
update_callback = function(self, c, index, objects)
|
|
|
|
|
|
|
|
-- Update indicator icon
|
2023-09-03 09:26:07 -07:00
|
|
|
if c.icon == nil then
|
|
|
|
self:get_children_by_id("clienticon")[1].image = beautiful.icons[config.core.default_clienticon]
|
|
|
|
else
|
|
|
|
self:get_children_by_id("clienticon")[1].image = c.icon
|
|
|
|
end
|
|
|
|
self:get_children_by_id("clienticon")[1]:emit_signal("widget::redraw_needed")
|
|
|
|
|
2021-08-01 07:24:26 -07:00
|
|
|
|
|
|
|
-- Update top color
|
|
|
|
if c == client.focus then
|
|
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA"
|
|
|
|
elseif c.minimized then
|
2021-08-01 08:05:19 -07:00
|
|
|
self:get_children_by_id("top_tab")[1].bg = beautiful.color.bar.hover_bg --beautiful.color.transparent
|
2022-04-24 13:40:49 -07:00
|
|
|
else
|
|
|
|
self:get_children_by_id("top_tab")[1].bg = "#2DA0DA77"
|
2021-08-01 07:24:26 -07:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
layout = wibox.layout.align.vertical,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return tasklist.make
|