From 5c57f43643906b8e7e9f04fbbb516b0482b0343d Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 6 Mar 2019 23:16:34 -0500 Subject: [PATCH] tasklist: Use awful.widget.clienticon by default. This allows sharper icons to be used. Fixes #2143 --- lib/awful/widget/tasklist.lua | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/awful/widget/tasklist.lua b/lib/awful/widget/tasklist.lua index 5fc7699c5..bfe6a0705 100644 --- a/lib/awful/widget/tasklist.lua +++ b/lib/awful/widget/tasklist.lua @@ -87,7 +87,13 @@ local timer = require("gears.timer") local gcolor = require("gears.color") local gstring = require("gears.string") local gdebug = require("gears.debug") +local dpi = require("beautiful").xresources.apply_dpi local base = require("wibox.widget.base") +local wfixed = require("wibox.layout.fixed") +local wmargin = require("wibox.container.margin") +local wtextbox = require("wibox.widget.textbox") +local clienticon = require("awful.widget.clienticon") +local wbackground = require("wibox.container.background") local function get_screen(s) return s and screen[s] @@ -247,6 +253,32 @@ local instances -- Public structures tasklist.filter, tasklist.source = {}, {} +-- This is the same template as awful.widget.common, but with an clienticon widget +local default_template = { + { + { + clienticon, + id = "icon_margin_role", + left = dpi(4), + widget = wmargin + }, + { + { + id = "text_role", + widget = wtextbox, + }, + id = "text_margin_role", + left = dpi(4), + right = dpi(4), + widget = wmargin + }, + fill_space = true, + layout = wfixed.horizontal + }, + id = "background_role", + widget = wbackground +} + local function tasklist_label(c, args, tb) if not args then args = {} end local theme = beautiful.get() @@ -423,7 +455,7 @@ local function tasklist_update(s, w, buttons, filter, data, style, update_functi local function label(c, tb) return tasklist_label(c, style, tb) end update_function(w, buttons, label, data, clients, { - widget_template = args.widget_template, + widget_template = args.widget_template or default_template, create_callback = create_callback, }) end