sirfoga
sirfoga

Reputation: 121

Pass conky object to external script

I have a conky object, and I want to pass it as parameter of a bash / lua script. How do I do it?

Example:

conky object: ${tcp_portmon 1 61000 lport 0} i.e the port of the first tcp connection

script: $ lsof -i :<PORT> | sed -n 2p | awk '{print $1}' i.e finds the process with that port

What I tried (unsuccessfully):

How do I do it?

PS: for reference, here is the link to the Github issue

Upvotes: 0

Views: 399

Answers (1)

David Yockey
David Yockey

Reputation: 620

The best way to pass the conky object to a lua function is... by not passing the object.

Instead, use the lua API function conky_parse within the lua function to evaluate the string '${tcp_portmon 1 61000 lport 0}' and then process the result as desired.

Alternativly, rather than hardcoding the string, you could pass the string '${tcp_portmon 1 61000 lport 0}' to the lua function and then use conky_parse on the passed string.

See the "LUA API" section of man conky for more info.

Upvotes: 1

Related Questions