hello group,
i need help with my calendar widget.
widget:
-- }}}
local calendar = nil
local offset = 0
function remove_calendar()
if calendar ~= nil then
naughty.destroy(calendar)
calendar = nil
offset = 0
end
end
function add_calendar(inc_offset)
local save_offset = offset
remove_calendar()
offset = save_offset + inc_offset
local datespec = os.date("*t")
datespec = datespec.year * 12 + datespec.month - 1 + offset
datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12)
local cal = awful.util.pread("cal " .. datespec)
cal = string.gsub(cal, "^%s*(.-)%s*$", "%1")
calendar = naughty.notify({
text = string.format('<span font_desc="%s">%s</span>',
"Profont", os.date("%a, %d. %B %Y") .. "\n" .. cal),
timeout = 0, hover_timeout = 0.5,
width = 165,
})
end
-- change clockbox for your clock widget (e.g. mytextclock)
mytextclock:add_signal("mouse::enter", function()
add_calendar(0)
end)
mytextclock:add_signal("mouse::leave", remove_calendar)
mytextclock:buttons(awful.util.table.join{
awful.button({ }, 4, function() add_calendar(-1) end),
awful.button({ }, 5, function() add_calendar(1) end),
})
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
problem: this widget should show calendar on mouse over but it tries to
highlight todays date (?) but it fails. instead of it if shifts current
week cells some 5 cells to right.
a picture is worth a thousand words. :
http://ompldr.org/vYjZtMg/cal.jpg
could you help me to set this right? i mean left. i mean to look fine :)
thanks in advance ;)
Matija