awesome: Open calendar on click

This commit is contained in:
Simon Bruder 2020-06-04 17:27:06 +02:00
parent ef24364853
commit a81388d206
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -206,40 +206,25 @@ widgets.notifications:buttons(
widgets.cal = {}
widgets.cal.show = function()
widgets.cal.hide()
widgets.cal.notification_processing = true
helpers.async({ "khal", "calendar" }, function(output)
widgets.cal.notification = naughty.notify{
screen = awful.screen.focused(),
text = output:gsub("\n$", ""),
timeout = 0,
}
widgets.cal.notification_processing = false
if widgets.cal.trigger_hide then
widgets.cal.hide()
widgets.cal.trigger_hide = false
end
end)
end
widgets.cal.hide = function()
if widgets.cal.notification_processing then
widgets.cal.trigger_hide = true
else
if not widgets.cal.notification then return end
widgets.cal.toggle = function()
if widgets.cal.notification ~= nil then
naughty.destroy(widgets.cal.notification)
widgets.cal.notification = nil
else
helpers.async({ "khal", "calendar" }, function(output)
widgets.cal.notification = naughty.notify{
screen = awful.screen.focused(),
text = output:gsub("\n$", ""),
timeout = 0,
}
end)
end
end
widgets.cal.attach = function(parent)
parent:connect_signal("mouse::enter", widgets.cal.show)
parent:connect_signal("mouse::leave", widgets.cal.hide)
parent:buttons(awful.util.table.join(
awful.button({}, 1, widgets.cal.toggle)
))
end
return widgets