I have a file which contains one word, "green", "yellow" or "red" (this file is updated via a cron job.

I would like to use that color to display text in Conky. The actual text would stay the same, but the color would update depending on that file. Does anyone know of a way to make this work? Thanks!

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Create a bash-script that outputs ${color yourcolor} :

#!/bin/bash

start="\${color "
color=$(cat color-file)
end="}"
echo -n $start$color$end

And run it in conky (every 10 seconds):

${execpi 10 /path/to/script.sh} Colored text here {color}

Something nested like ${color ${head /path/to/color-file 10}} might also work.

link|improve this answer
Thank you! Worked perfectly. – Trevor Dec 9 '11 at 15:04
feedback

Your Answer

 
or
required, but never shown

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