i3bar prints unformatted json irrespective of status_command
I'm having a problem with i3bar wherein none of the outputs from i3pystatus, i3phtatus nor conky are formatted correctly in i3bar. The same config (for i3pystatus at least) works perfectly on my desktop on Arch, but not on a new work laptop fixed on Ubuntu 12.04. Here are my configs and some outputs that might be useful to know before answering - I'll use conky as an example, since that can be found on the i3 wiki:
conkyrc:
out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
update_interval 1.0
total_run_times 0
short_units yes
use_spacer left
override_utf8_locale no
cpu_avg_samples 2
TEXT
# JSON for i3bar
[
{"full_text": "${time %I:%M %P}"}
],
conky start script (as advised on wiki)
# Send the header so that i3bar knows we want to use JSON:
echo '{"version":1}'
# Begin the endless array.
echo '['
# We send an empty first array of blocks to make the loop simpler:
echo '[],'
# Now send blocks with information forever:
exec conky -c $HOME/.i3/conkyrc
and finally my i3bar config at the end of .i3/config
bar {
position top
status_command $HOME/.i3/conky-i3bar
}
All that is outputted here is a single "]," in my i3bar. Any takers?
What does it output if you just run the script in a terminal? I'd guess this is a buffering issue.
Try prepending this to your status command: "stdbuf -o 0 -e 0"
Code formatting is horrible in comments, see the answer below
Adding the stdbuf line to my conky run script causes no output, likewise for adding it to my status_command as "stdbuf -o 0 -e 0 && conky -c $HOME/.i3/conkyrc"
Sorry, I should've been more clear. It's not a separate command to run, it's part of the command: "stdbuf -e 0 -o 0 $HOME/.i3/conkyrc"