This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i3bar-protocol: add example (illustration-only!) shell script, clarif…
…y {"version":1} header
- Loading branch information
1 parent
e53405c
commit f94edd9
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters