You are not logged in.

#1 2014-09-22 19:41:28

maninashed
Member
Registered: 2014-09-21
Posts: 2

[Solved] vicious widget format function errors

I am configuring the widgets in my awesome wm install. 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 (i.e. when I set the time also set the date tooltip):

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?

Last edited by maninashed (2014-09-24 22:51:29)

Offline

#2 2014-09-24 22:51:07

maninashed
Member
Registered: 2014-09-21
Posts: 2

Re: [Solved] vicious widget format function errors

It seems that not all vicious widget types support the format function option.

For a fuller explanation (and an alternative approach), see the answers on Stack Exchange.

Offline

Board footer

Powered by FluxBB