Awesome WM: redraw clock every second when hovered

This commit is contained in:
2013-11-10 12:30:51 +03:00
parent 3226ffa9b9
commit eaf81afc89
+7 -3
View File
@@ -20,15 +20,19 @@ function create(self, format)
}
local widget = wibox.widget.textbox()
local format = format or '%a, %m/%d %R'
local year, month = 0
local year, month = 0, 0
widget:connect_signal('mouse::enter', function()
year, month = os.date('%Y'), os.date('%m')
end)
local tooltip = awful.tooltip({
objects = { widget },
timer_function = function()
widget:set_text(os.date(' ' .. format .. ':%S '))
month, year = os.date('%m'), os.date('%Y')
return calendar_for_month_markup(month, year)
end,
timeout = 60 * 60
timeout = 1
})
function adjust_calendar(delta_months)
month = month + delta_months