From: Andrey Burov
Date: Thu, 1 Feb 2018 10:15:56 +0000 (+0300)
Subject: JSON formating
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F43%2Fhead;p=i3%2Fi3.github.io
JSON formating
---
diff --git a/docs/user-contributed/conky-i3bar.html b/docs/user-contributed/conky-i3bar.html
index 538f123..a9d94b3 100644
--- a/docs/user-contributed/conky-i3bar.html
+++ b/docs/user-contributed/conky-i3bar.html
@@ -47,11 +47,11 @@ Here's a sample JSON text for achieving our goal:
[
[].
- [ { "full_text":"Home 84.0G Free", "color":"#ffffff" },
- { "full_text":"RAM 32%" , "color":"#ffffff" } ],
+ [ { "full_text": "Home 84.0G Free", "color": "#ffffff" },
+ { "full_text": "RAM 32%" , "color": "#ffffff" } ],
- [ { "full_text":"Home 84.0G Free", "color":"#ffffff" },
- { "full_text":"RAM 34%" , "color":"#ffffff" } ],
+ [ { "full_text": "Home 84.0G Free", "color": "#ffffff" },
+ { "full_text": "RAM 34%" , "color": "#ffffff" } ],
[....],
[....],
@@ -104,8 +104,10 @@ In the i3 config file the bar config will be something like that
Now we have to write a ~/.conkyrc file in order to obtain the desired status:
-[{ "full_text":"Home 84.0G Free" , "color":"#ffffff" },
- { "full_text":"RAM 32%" , "color":"#ffffff" }],
+[
+ { "full_text": "Home 84.0G Free" , "color": "#ffffff" },
+ { "full_text": "RAM 32%" , "color": "#ffffff" }
+],
Here's a sample conkyrc that updates every 2 seconds. Just to make things a litte bit more exciting
@@ -145,15 +147,12 @@ we put a condition in the script in order to write the occupied RAM in red if th
-- number of cpu samples to average
-- set to 1 to disable averaging
cpu_avg_samples = 2,
-
- -- Stuff after 'TEXT' will be formatted on screen
};
conky.text = [[
-{% raw %}
-[{ "full_text" : "Home ${fs_free /home} Free" , "color" : "\#ffffff" },
-{ "full_text" : "RAM ${memperc}%" , "color" :
-${if_match ${memperc}<90}"\#ffffff"${else}"\#ff0000"${endif} }],
-{% endraw %}
+{% raw %}[
+ { "full_text": "Home ${fs_free /home} Free" , "color": "\#ffffff" },
+ { "full_text": "RAM ${memperc}%" , "color": ${if_match ${memperc}<90}"\#ffffff"${else}"\#ff0000"${endif} }
+],{% endraw %}
]];
/tt>