feat: add auto hide functionality to calendar widget

This commit is contained in:
Jonathon Terry 2024-08-03 14:49:30 -07:00 committed by GitHub
parent effc902821
commit 2063b0e8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 0 deletions

View File

@ -203,6 +203,23 @@ local function worker(user_args)
border_color = calendar_themes[theme].border,
widget = cal
}
local auto_hide_timer = gears.timer({
timeout = user_args.timeout or 2,
single_shot = true,
callback = function()
calendar_widget.toggle()
end,
})
popup:connect_signal("mouse::leave", function()
if user_args.auto_hide then
auto_hide_timer:again()
end
end)
popup:connect_signal("mouse::enter", function()
auto_hide_timer:stop()
end)
popup:buttons(
awful.util.table.join(
@ -250,6 +267,10 @@ local function worker(user_args)
end
popup.visible = true
if user_args.auto_hide then
auto_hide_timer:start()
end
end
end