From e526d2f962ab86a02797c5d98d0eb981d987b381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sat, 23 Jul 2022 19:13:05 +0200 Subject: [PATCH] Custom tasklist filter --- awesome/components/pastel/top-panel.lua | 8 ++------ awesome/rc.lua | 9 ++++----- awesome/widgets/task-list.lua | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/awesome/components/pastel/top-panel.lua b/awesome/components/pastel/top-panel.lua index bad30f8..f0c3cec 100644 --- a/awesome/components/pastel/top-panel.lua +++ b/awesome/components/pastel/top-panel.lua @@ -29,10 +29,6 @@ local task_list = require("widgets.task-list") -- =================================================================== local top_panel = {} -local task_lists = {layout = wibox.layout.fixed.horizontal} -awful.screen.connect_for_each_screen(function(s) - table.insert(task_lists, task_list.create(s)) -end) local updates_indicator = wibox.widget{ { @@ -98,8 +94,8 @@ top_panel.create = function(s) panel:setup { expand = "none", layout = wibox.layout.align.horizontal, - task_lists, - wibox.widget{}, + task_list.create(s), + nil, { layout = wibox.layout.fixed.horizontal, pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline), diff --git a/awesome/rc.lua b/awesome/rc.lua index 1aa69c4..a6dca53 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -157,15 +157,14 @@ require("awesomewm-vim-tmux-navigator") { local handle_single_win = function(focused) local hide = focused.maximized or focused.fullscreen - for i, c in ipairs(client.get()) do if not c.floating and c.screen == focused.screen then - c.hidden = hide + c.minimized = hide end end - focused.hidden = false + focused.minimized = false end - -client.connect_signal("property::fullscreen", handle_single_win) +-- +-- client.connect_signal("property::fullscreen", handle_single_win) client.connect_signal("property::maximized", handle_single_win) diff --git a/awesome/widgets/task-list.lua b/awesome/widgets/task-list.lua index f8e9d2f..afb9e41 100644 --- a/awesome/widgets/task-list.lua +++ b/awesome/widgets/task-list.lua @@ -197,10 +197,26 @@ local tasklist_buttons = awful.util.table.join( ) +local filter = function(c, _) + local tags = c.screen.tags + for _, t in ipairs(tags) do + if t.selected then + local ctags = c:tags() + for _, v in ipairs(ctags) do + if v == t then + return true + end + end + end + end + return false +end + + task_list.create = function(s) return awful.widget.tasklist( s, - awful.widget.tasklist.filter.currenttags, + filter, tasklist_buttons, {}, list_update,