Skip to content

Instantly share code, notes, and snippets.

@intrntbrn
Last active March 29, 2024 09:20
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save intrntbrn/08af1058d887f4d10a464c6f272ceafa to your computer and use it in GitHub Desktop.
Save intrntbrn/08af1058d887f4d10a464c6f272ceafa to your computer and use it in GitHub Desktop.
awesomewm fancy_taglist: a taglist that contains a tasklist for each tag
-- awesomewm fancy_taglist: a taglist that contains a tasklist for each tag.
-- Usage:
-- 1. Save as "fancy_taglist.lua" in ~/.config/awesome
-- 2. Add a fancy_taglist for every screen:
-- awful.screen.connect_for_each_screen(function(s)
-- ...
-- local fancy_taglist = require("fancy_taglist")
-- s.mytaglist = fancy_taglist.new({
-- screen = s,
-- taglist_buttons = mytagbuttons,
-- tasklist_buttons = mytasklistbuttons
-- })
-- ...
-- end)
-- 3. Add s.mytaglist to your wibar.
local awful = require("awful")
local wibox = require("wibox")
local module = {}
local generate_filter = function(t)
return function(c, scr)
local ctags = c:tags()
for _, v in ipairs(ctags) do
if v == t then
return true
end
end
return false
end
end
local fancytasklist = function(cfg, t)
return awful.widget.tasklist({
screen = cfg.screen or awful.screen.focused(),
filter = generate_filter(t),
buttons = cfg.tasklist_buttons,
widget_template = {
{
id = "clienticon",
widget = awful.widget.clienticon,
},
layout = wibox.layout.stack,
create_callback = function(self, c, _, _)
self:get_children_by_id("clienticon")[1].client = c
awful.tooltip({
objects = { self },
timer_function = function()
return c.name
end,
})
end,
},
})
end
function module.new(config)
local cfg = config or {}
local s = cfg.screen or awful.screen.focused()
local taglist_buttons = cfg.taglist_buttons
return awful.widget.taglist({
screen = s,
filter = awful.widget.taglist.filter.all,
widget_template = {
{
{
-- tag
{
id = "text_role",
widget = wibox.widget.textbox,
align = "center",
},
-- tasklist
{
id = "tasklist_placeholder",
layout = wibox.layout.fixed.horizontal,
},
layout = wibox.layout.fixed.horizontal,
},
id = "background_role",
widget = wibox.container.background,
},
layout = wibox.layout.fixed.horizontal,
create_callback = function(self, _, index, _)
local t = s.tags[index]
self:get_children_by_id("tasklist_placeholder")[1]:add(fancytasklist(cfg, t))
end,
},
buttons = taglist_buttons,
})
end
return module
@mipmip
Copy link

mipmip commented Aug 31, 2021

Thanks!

@code-IM-perfect
Copy link

can you please provide a screenshot?

@intrntbrn
Copy link
Author

can you please provide a screenshot?

here is my custom implementation:

imgur-2022_09_09-15:48:29

@code-IM-perfect
Copy link

Thanks, that looks AWESOME

@elken
Copy link

elken commented Oct 29, 2022

It's on my list to fix, but in case you have some insight; upon the first client opening on a screen, the taglist claims that it exists on all tags on that screen

image

All I've changed is making it filter out non-empty tags (and even without that change it's still the same)

@madhur
Copy link

madhur commented Jan 3, 2023

Is it possible to use it with awful.widget.taglist.filter.noempty , I see displaying all tags are hardcoded in script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment