The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

i3bar prints unformatted json irrespective of status_command

asked 2015-10-15 14:38:51 +0000

charmedxi gravatar image

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?

edit retag flag offensive close merge delete

Comments

What does it output if you just run the script in a terminal? I'd guess this is a buffering issue.

Airblader gravatar imageAirblader ( 2015-10-15 16:23:17 +0000 )edit

Try prepending this to your status command: "stdbuf -o 0 -e 0"

Airblader gravatar imageAirblader ( 2015-10-15 16:47:39 +0000 )edit

Code formatting is horrible in comments, see the answer below

charmedxi gravatar imagecharmedxi ( 2015-10-15 16:49:37 +0000 )edit

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"

charmedxi gravatar imagecharmedxi ( 2015-10-15 16:53:37 +0000 )edit

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"

Airblader gravatar imageAirblader ( 2015-10-15 18:36:07 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-10-15 16:48:38 +0000

charmedxi gravatar image

For conky:

 WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-V9wLAb/pkcs11: No such file or directory
[
    {"full_text": "05:47 pm"}
],

For i3pystatus with a similar config:

{"click_events": false, "version": 1}
[
[{"urgent": false, "name": "i3pystatus.clock.Clock", "full_text": "Thu 15 Oct 17:48:07 KW42", "instance": "19972048", "markup": "none"}]
,[{"urgent": false, "name": "i3pystatus.clock.Clock", "full_text": "Thu 15 Oct 17:48:08 KW42", "instance": "19972048", "markup": "none"}]
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-15 14:38:51 +0000

Seen: 37 times

Last updated: Oct 15