I am configuring the widgets in awesome wm (v3.5.5-1) using vicious (v2.1.3-1). I want to show the time in a widget. And then show the date in the tooltip when I hover over the time widget.
The following code using vicious in my rc.lua file works fine:
myclock = wibox.widget.textbox()
vicious.register(myclock, vicious.widgets.date, " <span color='#ffffff'>%H:%M</span> ")
myclock_tooltip = awful.tooltip ({ objects = { myclock } })
vicious.register(myclock_tooltip, vicious.widgets.date, " %a %d %b ", 60)
However, when I try to combine the two vicious.register
statements (based on the Format functions section of the vicious readme file):
myclock = wibox.widget.textbox()
myclock_tooltip = awful.tooltip ({ objects = { myclock } })
vicious.register(myclock, vicious.widgets.date,
function (widget, args)
myclock_tooltip.set_text(" %a %d %b ")
return " <span color='#ffffff'>%H:%M</span> "
end)
I get the following error:
/usr/share/lua/5.2/vicious/widgets/date.lua:23: bad argument #1 to 'date' (string expected, got function)
Any suggestions where I'm going wrong?
Why do you need that format function at all? Doesn't the following work?
myclock = wibox.widget.textbox()
myclock_tooltip = awful.tooltip ({ objects = { myclock } })
vicious.register(myclock, vicious.widgets.date, " <span color='#fffff'>%H:%M</span> ")
myclock_tooltip_timer = timer({ timeout = 3600 })
myclock_tooltip_timer:connect_signal("timeout", function()
myclock_tooltip:set_text(os.date(" %a %d %b "))
end)
myclock_tooltip_timer:start()
myclock_tooltip_timer:emit_signal("timeout")
This uses the "normal" vicious stuff for the widget and updates your tooltip with a seperate timer which fires once per hour.