i3bar and conky => using ifs from conky in JSON?

asked 2015-10-30 15:51:43 +0000

toogley gravatar image

updated 2015-10-31 08:48:52 +0000

Hello,

I want to make a wlan notification using conky. The code below results in

"Error: Could not parse JSON (parse error: invalid object key (must be a string))"

According to http://i3wm.org/docs/i3bar-protocol.html the syntax and that should work, so i assume the error is caused by the ifs from conky.

I want one single block, with the strings "WLAN" (in e.g. gray) and "1" if the wlan interface is up and "0" when its down. (in red, respecively green)

How could i make this work?

EDIT: I use instead of this approach now a seperate block for both strings, but with "separator": false

My conkyrc:

out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
total_run_times 0
if_up_strictness address
use_spacer left
override_utf8_locale no
cpu_avg_samples 2
TEXT
[
    { # <-- caused error
        {
            "full_text": "WLAN: ",
            "color": "\#432355"
        },

        {
            "full_text":
            ${if_up wlan0}
                "1 ",
            ${else}
                "0 ",
            ${endif}

            "color":
            ${if_up wlan0}
                "\#009900"
            ${else}
                "\#990000"
            ${endif}
        }
    }, # <--- caused error
],
edit retag flag offensive close merge delete

Comments

Run only conky and see if its output is a correct JSON.

i3convert gravatar imagei3convert ( 2015-10-30 16:21:58 +0000 )edit

Ah, thanks. It didn't liked the the big { } i've marked

toogley gravatar imagetoogley ( 2015-10-31 08:44:57 +0000 )edit