3

I have ${top cpu 1} that show me for example 13.34. Is it possible to round this to 13?

1
  • I think it is not possible directly, but use execi to do something like this answer as workaround.
    – user125388
    Oct 25, 2015 at 10:03

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .