Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Execbar cannot access variables (w/o error) that Exec can, on startup. (Lua/Conky_Parse) #1699

Open
mzmncb opened this issue Dec 8, 2023 · 2 comments
Labels
bug Bug report or bug fix PR text Issue or PR related to `conky.text` variables triage Issue that hasn't been verified

Comments

@mzmncb
Copy link

mzmncb commented Dec 8, 2023

What happened?

When using conky_parse in a Lua script, a template using Execbar will (temporarily) not be able to access variables passed to it, even when they are available. After a few seconds (cycles?), Execbar does access the variables without error.

However, a template using Exec -can- access those same variables just fine at startup, without errors.

Even if a value is hardcoded into the template instead of passed in as an argument, the Execbar template will still throw an error on startup.

Version

conky 1.13.1 compiled 2022-10-02 for Linux x86_64

Which OS/distro are you seeing the problem on?

Linux (other)

Conky config

==========
conky conf
==========

conky.config = {
    own_window_class = 'Conky',
    own_window_title = 'Conky',
    own_window_type = 'normal',
    cpu_avg_samples = 2,
    double_buffer = true,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_x = true,
    own_window = true,
    update_interval = 1,
    use_xft = true,
    lua_load = '.../test-1.lua',
    template0 = "${exec [ -n \"\\1\" ] && echo \"33 66 99\"}",
    template1 = "${exec echo \"\\1 \\2 \\3 \\4\"}",
    template2 = "${execbar 4,125 echo \"\\4\"}"
}

conky.text = [[
Test-1:
${lua eval_tpl template1 arg1 ${template0 arg1}}
# --> [exec] No error when reading variables on initial load

${lua eval_tpl template2 arg1 ${template0 arg1}}
# --> [execbar] Error when reading variables on initial load
# --> conky: reading exec value failed (perhaps it's not the correct format?)
]]

==========
lua_load code
==========

ct = 0
function conky_eval_tpl(arg0, arg1, t1)
  print(ct)

  p1 = conky_parse(t1)

  print("p1 [" .. p1 .. "]")

  t2 = "${" .. arg0 .. " " .. arg1 .. " " .. p1 .. "}"

  print("t2 [" .. t2 .. "]")

  p2 = conky_parse(t2)

  print()

  ct = ct + 1
  return p2
end

Stack trace

No response

Relevant log output

$ conky -c .../test-1.conf;
conky: desktop window (3f3) is root window
conky: window type - normal
conky: drawing to created window (0x4600001)
conky: drawing to double buffer
0
p1 []
t2 [${template1 arg1 }]
--> template1 [Exec]:       values missing, but no error

1
p1 []
t2 [${template2 arg1 }]
conky: reading exec value failed (perhaps it's not the correct format?)
--> template2 [Execbar]:    values missing, and error

2
p1 [33 66 99]
t2 [${template1 arg1 33 66 99}]
--> template1 [Exec]:       values present, no error

3
p1 [33 66 99]
t2 [${template2 arg1 33 66 99}]
conky: reading exec value failed (perhaps it's not the correct format?)
--> template2 [Execbar]:    values present, but still reports an error

4
p1 [33 66 99]
t2 [${template1 arg1 33 66 99}]
--> template1 [Exec]:       values present, no error

5
p1 [33 66 99]
t2 [${template2 arg1 33 66 99}]
--> template2 [Execbar]:    values present, error stops...

...

--> no more errors...
@mzmncb mzmncb added bug Bug report or bug fix PR triage Issue that hasn't been verified labels Dec 8, 2023
@mzmncb
Copy link
Author

mzmncb commented Dec 8, 2023

Not sure if it's OK to repost this. My first post was removed (#1697).

@Caellian Caellian added the text Issue or PR related to `conky.text` variables label Apr 19, 2024
@Caellian
Copy link
Collaborator

Not sure if it's OK to repost this. My first post was removed.

It's ok, not sure why it was removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR text Issue or PR related to `conky.text` variables triage Issue that hasn't been verified
Projects
None yet
Development

No branches or pull requests

2 participants