You are not logged in.
Is there a way to make it so the displayed numbers have a 0 before them when they're single digits (0-9)?
-- CPU Usage
cpuwidget = wibox.widget.textbox()
vicious.register(cpuwidget, vicious.widgets.cpu, "CPU $1% | ")
-- RAM Usage
memwidget = wibox.widget.textbox()
vicious.register(memwidget, vicious.widgets.mem, "RAM $1% |", 13)
Offline
Change your vicious.register line to this:
vicious.register(cpuwidget, vicious.widgets.cpu, "CPU 0$1% | ")
vicious.register(memwidget, vicious.widgets.mem, "RAM 0$1% |", 13)
Also if you haven't read these web pages, you might want to give them a quick read.
http://awesome.naquadah.org/wiki/Vicious
http://git.sysphere.org/vicious/tree/README
Offline
Change your vicious.register line to this:
vicious.register(cpuwidget, vicious.widgets.cpu, "CPU 0$1% | ")
vicious.register(memwidget, vicious.widgets.mem, "RAM 0$1% |", 13)Also if you haven't read these web pages, you might want to give them a quick read.
http://awesome.naquadah.org/wiki/Vicious
http://git.sysphere.org/vicious/tree/README
I don't use vicious, but I'm pretty sure what you suggested will just prefix the value with a literal zero regardless of its width, which is not what the rzrscm was asking for. He wants his output to be zero-padded to a fixed width of two digits.
rzrscm, from the README that JoshuaBranson linked I think this should do it:
vicous.register(cpuwidget, vicious.widgets.cpu, function (widget, args)
return ("CPU %02d%% |"):format(args[1])
end)
Last edited by cmtptr (2013-07-06 18:09:30)
Offline