diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2012-08-12 18:47:24 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-08-12 18:47:24 +0200 |
commit | f94edd9fc3b5656ca197fb3f08a565b7894f4b52 (patch) | |
tree | 23b52792dc627df52e43d7d4a3018f3bbca0b478 /contrib | |
parent | e53405c216e2d1247cd68c856b84500f9546e128 (diff) | |
download | i3-f94edd9fc3b5656ca197fb3f08a565b7894f4b52.tar.gz i3-f94edd9fc3b5656ca197fb3f08a565b7894f4b52.zip |
i3bar-protocol: add example (illustration-only!) shell script, clarify {"version":1} header
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/trivial-bar-script.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/trivial-bar-script.sh b/contrib/trivial-bar-script.sh new file mode 100755 index 00000000..15bc7dee --- /dev/null +++ b/contrib/trivial-bar-script.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# vim:ts=4:sw=4:expandtab +# © 2012 Michael Stapelberg, Public Domain + +# This script is a trivial shell script to send your own output to i3bar while +# using the JSON protocol. +# +# It is ugly and that is inherent to using JSON with shell scripts. You +# _really_ should not do that. See i3status or i3status’s contrib/ directory +# for examples of how to handle the output in higher-level languages. +# +# This example is purely for illustration of the protocol. DO NOT USE IT IN THE +# REAL WORLD. + +# Send the header so that i3bar knows we want to use JSON: +echo '{ "version": 1 }' + +# Begin the endless array. +echo '[' + +# We send an empty first array of blocks to make the loop simpler: +echo '[]' + +# Now send blocks with information forever: +while :; +do + echo ",[{\"name\":\"time\",\"full_text\":\"$(date)\"}]" + sleep 1 +done |