File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 4
4
# <xbar.version>v0.0.1</xbar.version>
5
5
# <xbar.author>Kaspars Mickevics</xbar.author>
6
6
# <xbar.author.github>fxlv</xbar.author.github>
7
- # <xbar.desc>Displays bandwidth usage for the primary interface in Megabits/s</xbar.desc>
7
+ # <xbar.desc>Displays bandwidth usage for a network interface in Megabits/s</xbar.desc>
8
8
# <xbar.dependencies>ifstat</xbar.dependencies>
9
9
# <xbar.image>https://cloud.githubusercontent.com/assets/2462211/12748504/584bbcea-c9b3-11e5-8109-ad8fdcefdc75.png</xbar.image>
10
+ # <xbar.var>string(VAR_NETWORK_INTERFACE="en0"): The interface to track (Usual interface for MacOS wifi is en0)</xbar.var>
10
11
11
12
# based on bandwidth.1s.sh by Ant Cosentino
12
13
13
- # only gather stats from interface en0
14
- # no need to samlpe unused interfaces
15
- INTERFACE=" en0"
16
-
17
14
18
15
if [ ! -e /usr/local/bin/ifstat ]; then
19
16
echo " Please install ifstat or change the path to it in the script."
@@ -26,10 +23,10 @@ function kilo_to_mega {
26
23
}
27
24
28
25
function get_ifstat {
29
- interface =$1
26
+ IFSTAT_INTERFACE =$1
30
27
# 1 sample for 0.5 second interval
31
28
# outputs two values (in/out) in kilobits per second
32
- /usr/local/bin/ifstat -n -w -i " ${interface } " -b 0.5 1 | tail -n 1
29
+ /usr/local/bin/ifstat -n -w -i " ${IFSTAT_INTERFACE } " -b 0.5 1 | tail -n 1
33
30
}
34
31
35
32
function print_ifstat {
@@ -41,5 +38,5 @@ function print_ifstat {
41
38
42
39
}
43
40
44
- print_ifstat " $( get_ifstat ${INTERFACE } ) "
41
+ print_ifstat " $( get_ifstat ${VAR_NETWORK_INTERFACE } ) "
45
42
echo " ---"
You can’t perform that action at this time.
0 commit comments