]> git.sur5r.net Git - i3/i3status/blob - contrib/measure-net-speed-i3status.bash
9f9e5ce1ee36c6b065d80f9c30254a2405b0fec8
[i3/i3status] / contrib / measure-net-speed-i3status.bash
1 #!/bin/bash
2 # Public Domain
3 # (someone claimed the next lines would be useful for…
4 #  people. So here goes: © 2012 Stefan Breunig
5 #  stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de)
6
7 # append i3status output to the measure-net-speed’s one.
8 # the quote and escape magic is required to get valid
9 # JSON output, which is expected by i3bar (if you want
10 # colors, that is. Otherwise plain text would be fine).
11 # For colors, your i3status.conf should contain:
12 # general {
13 #   output_format = i3bar
14 # }
15
16 # i3 config looks like this:
17 # bar {
18 #   status_command measure-net-speed-i3status.bash
19 # }
20
21 i3status | (read line && echo $line && while :
22 do
23   read line
24   dat=$(measure-net-speed.bash)
25   dat="[{ \"full_text\": \"${dat}\" },"
26   echo "${line/[/$dat}" || exit 1
27 done)