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

Cannot pipe conky colors to i3bar using JSON, status doesn't get updated

asked 2013-01-20 00:34:55 +0000

naq gravatar image

updated 2013-01-20 00:39:01 +0000

I did exactly as it says in the documentation. I've struggled with this for two days many hours in a row. I have no experience with JSON so I don't know what I can do to fix it. I have the ~/.i3/conkyi3bar.sh which looks like this:

#!/bin/sh

echo '{ "version": 1 }'
echo '['
echo '[],'
exec conky -c $HOME/.i3/conkyi3rc

And this is the TEXT part from the conky script:

TEXT
[
{
  "full_text": "K: $kernel",
    "color": "\#BFBFBF"
},
{
  "full_text": "A: $machine",
  "color": "\#BFBFBF"
},
{
  "full_text": "U: $uptime",
  "color": "\#BFBFBF"
},
{
  "full_text": "CU0: ${cpu cpu1}%",
  "color":
    ${if_match ${cpu cpu1}>60}"\#FF0000"
    ${else}"\#BFBFBF"
    ${endif}
},
{
  "full_text": "CU1: ${cpu cpu2}%",
  "color":
    ${if_match ${cpu cpu2}>60}"\#FF0000"
    ${else}"\#BFBFBF"
    ${endif}
},
{
  "full_text": "C0:${hwmon 1 temp 2}°C",
  "color":
    ${if_match ${hwmon 1 temp 2}>45}"\#FF0000"
    ${else}"\#BFBFBF"
    ${endif}
},
{
  "full_text": "C1:${hwmon 1 temp 3}°C",
  "color":
    ${if_match ${hwmon 1 temp 3}>45}"\#FF0000"
    ${else}"\#BFBFBF"
    ${endif}
},
{
  "full_text": "M: $memeasyfree / $memperc%",
  "color":
    ${if_match ${memperc}>70}"\#FF0000"
    ${else}"\#BFBFBF"
    ${endif}
}
]

I wrote it like this to be easy to read (for me). At first I thought it may be the syntax, but I tried many ways. It made no difference. Without using the JSON protocol, the conky status gets piped without any problems, but I have to give up on colors. Maybe someone who knows JSON or the i3bar protocol better, can spot an error in my configs. I need a little help.

I'm using ArchLinux 64 bit with i3-git compiled yesterday in the hope that there will be something that can be fixed this way.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-01-22 06:29:55 +0000

Michael gravatar image

You are missing a trailing comma in the last line of your conky configuration.

See the example in http://i3wm.org/docs/i3bar-protocol.h...theprotocol — i3bar expects an infinite array of status lines, and JSON array elements are separated by commas from each other.

edit flag offensive delete link more

Comments

Thank you for replying Michael. I've read the docs and I tried putting a comma and didn't work. Now after you posted the answer and narrowed it down confirming me that that's the problem, I tried again and I realized that the comma had to be after the last ], not }, and so I did that and it works.

naq gravatar imagenaq ( 2013-01-22 06:51:01 +0000 )edit

Thank you.

naq gravatar imagenaq ( 2013-01-22 06:51:11 +0000 )edit

This was also helpful for me to find a solution to the same issue. Thank you!

dkeg gravatar imagedkeg ( 2013-01-29 12:51:15 +0000 )edit

Had perfect static colored Conky text, now it actually works ;-)

virtualeyes gravatar imagevirtualeyes ( 2013-03-11 22:02:12 +0000 )edit

Question Tools

Stats

Asked: 2013-01-20 00:34:55 +0000

Seen: 1,551 times

Last updated: Jan 22 '13