On Wed, 20 Nov 2013, Peiding CHEN wrote:
> I could only get the usage percentage number without symbole "%"
This is because you are using a format function, and you want some style
or markup added to this *text widget* (important for later):
function (widget, args)
-- Add text to a tooltip
cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%")
-- Return text to print in the wibox
return args[1] .. '%'
--return args[1] .. '<span color="red">%</span>'
end)
> nothing appears when I move the cursor above the graph.
>
> cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },})
So according to 3.5 documentation[1] this is still valid syntax.
But let's look closer at the object you are attaching it to:
> cpuwidget = wibox.widget.textbox()
This is no graph but a text widget. So probably this is the correct way
to attach to that:
> cpuwidget_t = awful.tooltip({ objects = { cpuwidget }, })
Finally the :set_text method still looks to be valid in 3.5, so this
should add text to the tooltip just fine:
> cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%")
1. http://awesome.naquadah.org/doc/api/modules/awful.tooltip.html
--
Adrian C. (anrxc) | anrxc..sysphere.org | PGP ID: D20A0618
PGP FP: 02A5 628A D8EE 2A93 996E 929F D5CB 31B7 D20A 0618
--
To unsubscribe, send mail to [email protected].