From b88a75b4102c103da2a75c6f937f06d055a27524 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 25 May 2011 16:25:13 -0500 Subject: [PATCH] * etc/byobu/statusrc, usr/lib/byobu/network: - add support for a network threshold setting; set to 20kbps by default, ignore network traffic less than 20kbps; less busy status --- debian/changelog | 3 +++ etc/byobu/statusrc | 1 + usr/lib/byobu/network | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 12737cf0..8d05c40b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ byobu (4.3) unreleased; urgency=low - fix the motd display at auto launch, which was broken recently * usr/lib/byobu/mem_available: - fix MB display bug + * etc/byobu/statusrc, usr/lib/byobu/network: + - add support for a network threshold setting; set to 20kbps by default, + ignore network traffic less than 20kbps; less busy status [ Scott Moser ] * usr/lib/byobu/.shutil: fix rounding across a decimal point in fpdiv() diff --git a/etc/byobu/statusrc b/etc/byobu/statusrc index 308d1917..6831508d 100644 --- a/etc/byobu/statusrc +++ b/etc/byobu/statusrc @@ -63,6 +63,7 @@ wifi_quality=1 #LOGO="\o/" #MONITORED_DISK=/ #MONITORED_INTERFACE=eth0 +#NETWORK_THRESHOLD=20 #MONITORED_TEMP=/proc/acpi/thermal_zone/THM0/temperature #TEMP=F #DISTRO=Ubuntu diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index 15afdfbc..82ed95b4 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -31,6 +31,10 @@ else while read cn other; do interface=$cn; done < /proc/net/route fi +# By default, we won't bug the user with the display of network traffic +# below NETWORK_THRESHOLD in kbps; override in $DATA/status +[ -n "$NETWORK_THRESHOLD" ] || NETWORK_THRESHOLD=20 + if [ "$1" = "--detail" ]; then LC_ALL=C /sbin/ifconfig "$interface" | sed 's/\s*$//' exit 0 @@ -91,7 +95,7 @@ for i in up down; do ;; esac fi - if [ "$rate" != "0" ]; then + if [ "$rate" -gt $NETWORK_THRESHOLD ]; then color b m w; printf "%s%s" "$symbol" "$rate"; color -; color m w; printf "%s" "$unit"; color -- fi done