local awful = require "awful" local gshape = require "gears.shape" local gtable = require "gears.table" local phosphor = require "assets.phosphor" local q = require "quarrel" local qcolor = require "quarrel.color" local qui = require "quarrel.ui" local qvars = require "quarrel.vars" local wibox = require "wibox" local M = {} M.last_focused_client = nil M.class_map = { ["org.wezfurlong.wezterm"] = "Wezterm", } M._popup = qui.popup { -- visible = false, ontop = true, placement = "right", shape = function(cr, w, h) gshape.partially_rounded_rect(cr, w, h, true, false, false, true, qui.BORDER_RADIUS) end, -- x = awful.screen.focused().geometry.width, -- minimum_width = width, -- maximum_width = width, -- maximum_height = max_height, widget = awful.widget.tasklist { screen = awful.screen.focused(), filter = awful.widget.tasklist.filter.allscreen, source = function(s) local ret = gtable.clone(s.all_clients, false) -- q.debug(ret) table.sort(ret, function(a, b) return a.class == b.class and (a.pid or 0) < (b.pid or 0) or a.class < b.class end) return ret end, layout = { spacing = qui.BIG_PADDING, layout = wibox.layout.fixed.vertical, }, widget_template = qui.styled { widget = wibox.container.background, bg = qcolor.palette.bg.high, qui.padded_big { { widget = wibox.container.place, { widget = wibox.container.constraint, strategy = "max", height = qui.CHAR_HEIGHT, width = qui.CHAR_HEIGHT, { widget = wibox.widget.imagebox, id = "icon_role", }, }, }, { widget = wibox.container.constraint, strategy = "max", width = qui.CHAR_WIDTH * 24, { widget = wibox.widget.textbox, id = "client_name", }, }, layout = wibox.layout.fixed.horizontal, spacing = qui.PADDING, }, create_callback = function(self, c) self:get_children_by_id("client_name")[1].text = M.class_map[c.class] or c.class if c.active then c.wasactive = true self.border_color = qcolor.palette.yellow() end end, update_callback = function(self, c) self:get_children_by_id("client_name")[1].text = M.class_map[c.class] or c.class if c.active then c.wasactive = true self.border_color = qcolor.palette.yellow() elseif c.wasactive then c.wasactive = false self.border_color = qcolor.palette.border() end end, }, }, } return M