awesome: Open calendar on click
This commit is contained in:
parent
ef24364853
commit
a81388d206
|
@ -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
|
||||
|
|
Reference in a new issue