]> git.sur5r.net Git - i3/i3/blob - contrib/trivial-bar-script.sh
dump-asy.pl: use correct tmp dirname instead of hardcoded /tmp
[i3/i3] / contrib / trivial-bar-script.sh
1 #!/bin/sh
2 # vim:ts=4:sw=4:expandtab
3 # © 2012 Michael Stapelberg, Public Domain
4
5 # This script is a trivial shell script to send your own output to i3bar while
6 # using the JSON protocol.
7 #
8 # It is ugly and that is inherent to using JSON with shell scripts. You
9 # _really_ should not do that. See i3status or i3status’s contrib/ directory
10 # for examples of how to handle the output in higher-level languages.
11 #
12 # This example is purely for illustration of the protocol. DO NOT USE IT IN THE
13 # REAL WORLD.
14
15 # Send the header so that i3bar knows we want to use JSON:
16 echo '{ "version": 1 }'
17
18 # Begin the endless array.
19 echo '['
20
21 # We send an empty first array of blocks to make the loop simpler:
22 echo '[]'
23
24 # Now send blocks with information forever:
25 while :;
26 do
27         echo ",[{\"name\":\"time\",\"full_text\":\"$(date)\"}]"
28         sleep 1
29 done