i3status/contrib/measure-net-speed-i3status.bash
Jiri Pinkava 5c583c418d contrib: fix premature insetion of status message into JSON
Pass first 2 lines of JSON unmodified. It contains protocol version
and start of block of blocks of status messages.
2013-02-27 01:20:56 +01:00

27 lines
803 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Public Domain
# (someone claimed the next lines would be useful for…
# people. So here goes: © 2012 Stefan Breunig
# stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de)
# append i3status output to the measure-net-speeds one.
# the quote and escape magic is required to get valid
# JSON output, which is expected by i3bar (if you want
# colors, that is. Otherwise plain text would be fine).
# For colors, your i3status.conf should contain:
# general {
# output_format = i3bar
# }
# i3 config looks like this:
# bar {
# status_command measure-net-speed-i3status.bash
# }
i3status | (read line && echo $line && read line && echo $line && while :
do
read line
dat=$(measure-net-speed.bash)
dat="[{ \"full_text\": \"${dat}\" },"
echo "${line/[/$dat}" || exit 1
done)