From e71213f88ea9687bf7ac7f299826a1505d623e43 Mon Sep 17 00:00:00 2001 From: René Neumann Date: Fri, 31 May 2013 10:34:28 +0200 Subject: Some i3 / conky changes --- .i3/scripts/json_escape.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to '.i3/scripts/json_escape.lua') diff --git a/.i3/scripts/json_escape.lua b/.i3/scripts/json_escape.lua index 03860b7..1715738 100644 --- a/.i3/scripts/json_escape.lua +++ b/.i3/scripts/json_escape.lua @@ -1,3 +1,23 @@ function conky_json(str) return string.gsub(conky_parse(str), '[\\"]', '\\%1') end + +function conky_i3(...) + d = "{" + key = true + for i,v in ipairs(arg) do + if key then + d = d .. "\"" .. v .. "\":" + key = false + else + d = d .. conky_parse(v) + if string.sub(v, -1) == '"' then + if i < table.getn(arg) then d = d .. "," end + key = true + else + d = d .. " " + end + end + end + return d .. "}" +end -- cgit v1.2.3-70-g09d2