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

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

You can write a small bit of lua code to do this for you. For example, in your ~/.conkyrc:

lua_load /tmp/mylua.lua
${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)

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.