I have ${top cpu 1} that show me for example 13.34. Is it possible to round this to 13?
Asked
Active
Viewed 925 times
3
Vitaly Zdanevich
- 358
1 Answers
2
You can write a small bit of lua code to do this for you. For example, in your ~/.conkyrc:
conky.config = {
lua_load = '/tmp/mylua.lua',
};
conky.text = [[
${lua conky_myfun ${top cpu 1}}
]]
and in file /tmp/mylua.lua
function conky_myfun(arg)
local n = conky_parse(arg)
return math.floor(tonumber(n)+.5)
end
This calls conky_myfun with the given arg. The function
evaluates the arg to get the value, it is converted to a number,
and rounded to the nearest integer.
meuh
- 51,383
execito do something like this answer as workaround. – Oct 25 '15 at 10:03