Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to do something with ${eval} in Conky, but I'm having problems even with a minimal example:

${eval ${exec echo '${font DejaVu Sans Mono :size=6}hey!'}}

As far as I understand, I would believe that I should see the string "hey!" printed with the 'DejaVu Sans Mono' font, but instead I'm getting this as output:

${font DejaVu Sans Mono :size=6}hey!

I want to be able to execute something as I would in the terminal, and then parse that as a Conky statement. Isn't the whole idea of $eval to parse that string again? If so, am I doing something wrong, am I misunderstanding how it works, or is that a bug in $eval?

share|improve this question
add comment

3 Answers

I got here with the same problem. In your example you need to replace exec with execp inside eval for it to work as expected.

share|improve this answer
add comment
up vote 1 down vote accepted

I don't know what's wrong with ${eval} and nobody in the Conky's chat was able to explain it to me, but they suggested using ${execpi} and it did exactly what I wanted :)

share|improve this answer
add comment

I think you need

${font DejaVu Sans Mono :size=6}${exec echo 'hey!'}

Conky formatting is not nested like HTML. Instead you set a formatting and it sticks until you change it. So, first we set the font and size (${font DejaVu Sans Mono :size=6}), and then we tell it what to output (${exec echo 'hey!'}), which is in this case the output of the command echo 'hey'.

So, if I put this

 ${font DejaVu Sans Mono :size=6}${font DejaVu Sans Mono :size=20}${exec echo 'hey!'}

'hey' would be printed in size 20 and the size 6 would be essentially useless. Hopefully that clears things up.

share|improve this answer
    
My example was just a simplified one. I don't actually need to have a ${font} in there but more complicated stuff. The question is aimed to execute something and then parse it. –  Seb Jul 2 '11 at 23:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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