0

Hello and thanks for the help.

I'm trying to display the conky builtin configuration variable "update_interval". I've set it to 4 seconds, so the output should show "4". Unfortunately, the output just shows the string, not the value of "4". I've tried:

${update_interval}
$update_interval

But the output just shows the string, not the value of "4".

I've searched for a solution and failed. (I'm obviously missing something simple, but I don't know what.) Any pointers or guidance appreciated.

Again, thanks for the help.

wonder
  • 33
  • 4

1 Answers1

0

As far as I've been able to tell, there isn't a way to display "update_interval" with conky commands alone.

You'll need to write a Lua function to get the update_interval value from the conky_info table in the Lua API, and return that value. Once written, you'll need to call the function at the point in your conky config file where you want the returned value to appear. See the LUA API section of man conky for more information.

For example, assume that my update_interval is 4. If I save the following as updtint.lua in ~/bin/lua_scripts...

function conky_updtint()
    if conky_window == nil then
        return
    end

    return string.format('%d', conky_info.update_interval)
end

...include the following in the conky.config section of my .conkyrc file...

lua_load = '~/bin/lua_scripts/updtint.lua'

...and the following in the conky.text section of my .conkyrc file...

${lua conky_updtint}

...then, conky displays...

4

For much more information, see Using Lua scripts at https://github.com/brndnmtthws/conky/wiki/Using-Lua-scripts-(Part-01)%3A-How-does-a-lua-script-work (note links to other parts are in the right-hand sidebar of the page) and Lua 5.3 Reference Manual at https://www.lua.org/manual/5.3/.

David Yockey
  • 595
  • 3
  • 11