You are not logged in.
I am trying to pipe conky (1.9.0) to a textbox in my statusbar in awesome (3.5). I am able to send text to the textbox with this shell command:
echo "conky_widget:set_text(\" text \")" | awesome-clientBut my attempts to send conky's output this way have failed thus far. Another option I tried was the bashets addon, but it kept giving me weird errors, so it might not yet be compatible with awesome 3.5 The things I tried:
Making conky output the following string and simply piping it to awesome (conky | awesome-client) doesn't show anything.
conky_widget:set_text(\"${cpu}%\")The execp function of conky is supposed to execute an external shell command each interval, but unfortunately it fails to parse the string and only outputs the % sign to the textbox. Messing around with ${eval ${exec}} also didn't yeal any results.
${execp echo "conky_widget:set_text(\" ${cpu}% \")" | awesome-client}As a last resort I also tried to write conky's output to a file (in ram), planning to use a shell script to forward it to awesome-client, but somehow the file keeps accumulating instead of overwriting though I am using ">" instead of ">>".
conky > /tmp/conky-awesomeAnyone know of a solution to this? Maybe I am making some kind of syntax error somewhere? I think there must be a simple solution, like a small shell script or something or maybe a conky configuration in lua. But I have no idea how to work it out.
This is my .conkyrc:
background no
no_buffers yes
out_to_console yes
update_interval 2
uppercase no
use_spacer none
total_run_times 0
TEXT
conky_widget:set_text(\"${cpu}%\")Offline
This should read lines out of conky, escape quotes, and then set the widget text. It may need some debugging.
conky | sed -e "s/'/\\\'/g" | while read line; do
echo "conky_widget:set_text('$line')" | awesome-client
doneOffline
Thanks! It only worked without the sed command though. Like this:
conky | while read line; do
echo "conky_widget:set_text('$line')" | awesome-client
doneBtw, any idea how to incorporate this markup for the separators? Needs escaping, but that was the part that failed.
"<span color='" .. beautiful.separator .. "'> | </span>"Piping has always been a mystery to me, sometimes it works and sometimes not. And I can't figure out the difference between the many different ways ("|", "$()", "| -", "<", ">") and why some of them work in certain situations and others not. Anyone know of a good information source on this subject (one that surpasses "This is piping: command1 | command2" and explains the fundamental workings and the correct use and the exeptions)?
Offline
Markup: http://awesome.naquadah.org/doc/api/mod … set_markup
Also, for the quote escaping to work, you need to use 'read -r':
conky | sed -e "s/'/\\\'/g" | while read -r line; do
echo -E "conky_widget:set_text('$line')" | awesome-client
done-- edit:
As for your second question, this should help: http://www.tldp.org/LDP/abs/html/io-redirection.html
Last edited by Stebalien (2013-01-24 20:27:01)
Offline