dots/.config/awesome/components/statusbar/taglist.lua
2023-01-29 10:02:22 +01:00

87 lines
2.6 KiB
Lua

local awful = require "awful"
local xresources = require "beautiful.xresources"
local dpi = xresources.apply_dpi
local vars = require "themes.prismite.vars"
local wibox = require "wibox"
local naughty = require "naughty"
return awful.widget.taglist({
screen = screen[1],
filter = awful.widget.taglist.filter.all,
style = {
shape = vars.shape
},
layout = {
spacing = 8,
layout = wibox.layout.fixed.vertical
},
widget_template = {
{
{
{
id = "text_role",
widget = wibox.widget.textbox,
},
widget = wibox.container.place,
},
{
widget = wibox.container.background,
bg = vars.colors.bright.black,
shape = vars.shape,
forced_height = dpi(2),
forced_width = dpi(16),
id = "indicator_role"
},
layout = wibox.layout.fixed.vertical
},
widget = wibox.container.place,
create_callback = function(self, tag)
local indicator = self:get_children_by_id("indicator_role")[1]
local text = self:get_children_by_id("text_role")[1]
-- naughty.notification {
-- message = "b ".. tostring(text.font)
-- }
-- text.font = "FiraCode Nerd Font Mono SemiBold 12"
-- naughty.notification {
-- message = "a " .. tostring(text.font)
-- }
self:connect_signal("mouse::enter", function()
if tag.selected then return end
indicator.bg = vars.colors.yellow
end)
self:connect_signal("mouse::leave", function()
if tag.selected then return end
indicator.bg = vars.colors.bright.black
end)
if tag.selected then
indicator.bg = vars.colors.yellow
end
end,
update_callback = function(self, tag)
local indicator = self:get_children_by_id("indicator_role")[1]
if tag.selected then
indicator.bg = vars.colors.yellow
else
indicator.bg = vars.colors.bright.black
end
end
},
buttons = {
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
}
})