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 = {}
|
||||||
|
|
||||||
widgets.cal.show = function()
|
widgets.cal.toggle = function()
|
||||||
widgets.cal.hide()
|
if widgets.cal.notification ~= nil then
|
||||||
|
|
||||||
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
|
|
||||||
naughty.destroy(widgets.cal.notification)
|
naughty.destroy(widgets.cal.notification)
|
||||||
widgets.cal.notification = nil
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
widgets.cal.attach = function(parent)
|
widgets.cal.attach = function(parent)
|
||||||
parent:connect_signal("mouse::enter", widgets.cal.show)
|
parent:buttons(awful.util.table.join(
|
||||||
parent:connect_signal("mouse::leave", widgets.cal.hide)
|
awful.button({}, 1, widgets.cal.toggle)
|
||||||
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
return widgets
|
return widgets
|
||||||
|
|
Reference in a new issue