SketchyBar/plugins/network_graph.sh

10 lines
390 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-09-06 23:51:46 +00:00
MAX_DOWN=110000
MAX_UP=45000
UPDOWN=$(ifstat -i "en0" -b 0.1 1 | tail -n1)
2021-09-06 23:51:46 +00:00
DOWN=$(echo $UPDOWN | awk "{ print \$1 }" | cut -f1 -d ".")
UP=$(echo $UPDOWN | awk "{ print \$2 }" | cut -f1 -d ".")
sketchybar -m push network_down $(echo $UPDOWN | awk "{ print \$1 / (1.0 * $MAX_DOWN) }")
sketchybar -m push network_up $(echo $UPDOWN | awk "{ print \$2 / (1.0 * $MAX_UP) }")