[todo] highlight widget when the popup is shown

This commit is contained in:
streetturtle 2021-03-06 13:31:22 -05:00
parent 36ff9d53b7
commit 223fe7226a
1 changed files with 25 additions and 11 deletions

View File

@ -25,25 +25,37 @@ local rows = { layout = wibox.layout.fixed.vertical }
local todo_widget = {} local todo_widget = {}
local update_widget local update_widget
todo_widget.widget = wibox.widget { todo_widget.widget = wibox.widget {
{
{
{ {
{ {
id = "icon", id = "icon",
forced_height = 16,
forced_width = 16,
widget = wibox.widget.imagebox widget = wibox.widget.imagebox
}, },
id = "margin", valign = 'center',
margins = 4, layout = wibox.container.place
layout = wibox.container.margin
}, },
{ {
id = "txt", id = "txt",
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },
spacing = 4,
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
},
margins = 4,
layout = wibox.container.margin
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end,
widget = wibox.container.background,
set_text = function(self, new_value) set_text = function(self, new_value)
self.txt.text = new_value self:get_children_by_id("txt")[1].text = new_value
end, end,
set_icon = function(self, new_value) set_icon = function(self, new_value)
self.margin.icon.image = new_value self:get_children_by_id("icon")[1].image = new_value
end end
} }
@ -302,11 +314,13 @@ local function worker(user_args)
end end
todo_widget.widget:buttons( todo_widget.widget:buttons(
awful.util.table.join( gears.table.join(
awful.button({}, 1, function() awful.button({}, 1, function()
if popup.visible then if popup.visible then
todo_widget.widget:set_bg('#00000000')
popup.visible = not popup.visible popup.visible = not popup.visible
else else
todo_widget.widget:set_bg(beautiful.bg_focus)
popup:move_next_to(mouse.current_widget_geometry) popup:move_next_to(mouse.current_widget_geometry)
end end
end) end)