awesome: Add calendar widget
This commit is contained in:
parent
646f0a3ae5
commit
7d21067bd4
|
@ -107,6 +107,10 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
|
||||||
-- Create a textclock widget
|
-- Create a textclock widget
|
||||||
mytextclock = wibox.widget.textclock()
|
mytextclock = wibox.widget.textclock()
|
||||||
|
|
||||||
|
-- Create calendar and attach it to textclock
|
||||||
|
mycal = widgets.cal
|
||||||
|
mycal.attach(mytextclock)
|
||||||
|
|
||||||
-- Create a wibox for each screen and add it
|
-- Create a wibox for each screen and add it
|
||||||
local taglist_buttons = gears.table.join(
|
local taglist_buttons = gears.table.join(
|
||||||
awful.button({ }, 1, function(t) t:view_only() end),
|
awful.button({ }, 1, function(t) t:view_only() end),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local wibox = require("wibox")
|
|
||||||
local gtable = require("gears.table")
|
local gtable = require("gears.table")
|
||||||
|
local naughty = require("naughty")
|
||||||
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local lain = require("lain")
|
local lain = require("lain")
|
||||||
local helpers = require("lain.helpers")
|
local helpers = require("lain.helpers")
|
||||||
|
@ -187,4 +188,29 @@ widgets.tearstop:buttons(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
widgets.cal = {}
|
||||||
|
|
||||||
|
widgets.cal.show = function()
|
||||||
|
widgets.cal.hide()
|
||||||
|
|
||||||
|
helpers.async({ "khal", "calendar" }, function(output)
|
||||||
|
widgets.cal.notification = naughty.notify{
|
||||||
|
screen = awful.screen.focused(),
|
||||||
|
text = output:gsub("\n$", ""),
|
||||||
|
timeout = 0,
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
widgets.cal.hide = function()
|
||||||
|
if not widgets.cal.notification then return end
|
||||||
|
naughty.destroy(widgets.cal.notification)
|
||||||
|
widgets.cal.notification = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
widgets.cal.attach = function(parent)
|
||||||
|
parent:connect_signal("mouse::enter", widgets.cal.show)
|
||||||
|
parent:connect_signal("mouse::leave", widgets.cal.hide)
|
||||||
|
end
|
||||||
|
|
||||||
return widgets
|
return widgets
|
||||||
|
|
Reference in a new issue