summaryrefslogtreecommitdiff
path: root/.i3/scripts
diff options
context:
space:
mode:
authorRené Neumann <rene.neumann@in.tum.de>2013-05-31 10:34:28 +0200
committerRené Neumann <rene.neumann@in.tum.de>2013-05-31 10:34:29 +0200
commite71213f88ea9687bf7ac7f299826a1505d623e43 (patch)
treed823681b347f233fa6f2ee038ae469248e68b213 /.i3/scripts
parent715e8a3e714753a1dd3810ef87fa43b636b0e913 (diff)
downloaddotfiles-e71213f88ea9687bf7ac7f299826a1505d623e43.tar.gz
dotfiles-e71213f88ea9687bf7ac7f299826a1505d623e43.tar.bz2
dotfiles-e71213f88ea9687bf7ac7f299826a1505d623e43.zip
Some i3 / conky changes
Diffstat (limited to '.i3/scripts')
-rw-r--r--.i3/scripts/json_escape.lua20
1 files changed, 20 insertions, 0 deletions
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