From 223fe7226a6d8d0a48bb321ae1b307f635e9e65b Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 6 Mar 2021 13:31:22 -0500 Subject: [PATCH] [todo] highlight widget when the popup is shown --- todo-widget/todo.lua | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/todo-widget/todo.lua b/todo-widget/todo.lua index b8ce3cf..78ca262 100644 --- a/todo-widget/todo.lua +++ b/todo-widget/todo.lua @@ -27,23 +27,35 @@ local update_widget todo_widget.widget = wibox.widget { { { - id = "icon", - widget = wibox.widget.imagebox + { + { + id = "icon", + forced_height = 16, + forced_width = 16, + widget = wibox.widget.imagebox + }, + valign = 'center', + layout = wibox.container.place + }, + { + id = "txt", + widget = wibox.widget.textbox + }, + spacing = 4, + layout = wibox.layout.fixed.horizontal, }, - id = "margin", margins = 4, layout = wibox.container.margin }, - { - id = "txt", - widget = wibox.widget.textbox - }, - layout = wibox.layout.fixed.horizontal, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end, + widget = wibox.container.background, set_text = function(self, new_value) - self.txt.text = new_value + self:get_children_by_id("txt")[1].text = new_value end, set_icon = function(self, new_value) - self.margin.icon.image = new_value + self:get_children_by_id("icon")[1].image = new_value end } @@ -302,11 +314,13 @@ local function worker(user_args) end todo_widget.widget:buttons( - awful.util.table.join( + gears.table.join( awful.button({}, 1, function() if popup.visible then + todo_widget.widget:set_bg('#00000000') popup.visible = not popup.visible else + todo_widget.widget:set_bg(beautiful.bg_focus) popup:move_next_to(mouse.current_widget_geometry) end end)