Last active
July 22, 2024 03:42
-
-
Save intrntbrn/08af1058d887f4d10a464c6f272ceafa to your computer and use it in GitHub Desktop.
awesomewm fancy_taglist: a taglist that contains a tasklist for each tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
Is it possible to use it with awful.widget.taglist.filter.noempty
, I see displaying all tags are hardcoded in script
@madhur, try replacing line 67 filter = awful.widget.taglist.filter.all
with filter = awful.widget.taglist.filter.noempty
and replacing lines 88-91 with
create_callback = function(self, tag, index, _)
self:get_children_by_id("tasklist_placeholder")[1]:add(fancytasklist(cfg, tag))
end,
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
All I've changed is making it filter out non-empty tags (and even without that change it's still the same)