functional
This commit is contained in:
parent
2be4549c15
commit
622f27f886
4
main.go
4
main.go
|
@ -76,7 +76,7 @@ Options:
|
|||
-f, --fahrenheit Show temperatures in fahrenheit.
|
||||
-s, --statusbar Show a statusbar with the time.
|
||||
-b, --battery Show battery level widget ('minimal' turns off).
|
||||
-i, --interface Select network interface [default: all].
|
||||
-i, --interface=NAME Select network interface [default: all].
|
||||
|
||||
Colorschemes:
|
||||
default
|
||||
|
@ -118,7 +118,7 @@ Colorschemes:
|
|||
if fahrenheit {
|
||||
tempScale = w.Fahrenheit
|
||||
}
|
||||
netInterface, _ := args["--interface"].(string)
|
||||
netInterface, _ = args["--interface"].(string)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ func NewNetWidget(netInterface string) *NetWidget {
|
|||
}
|
||||
self.Title = " Network Usage "
|
||||
if netInterface != "all" {
|
||||
self.Title = fmt.Sprintf(" %s Usage ", netInterface)
|
||||
self.Title = fmt.Sprintf(" %s Usage ", netInterface)
|
||||
}
|
||||
|
||||
self.update()
|
||||
|
@ -64,11 +64,8 @@ func (self *NetWidget) update() {
|
|||
var totalBytesRecv uint64
|
||||
var totalBytesSent uint64
|
||||
for _, _interface := range interfaces {
|
||||
// ignore VPN interface
|
||||
if _interface.Name != "tun0" && self.NetInterface == "all" {
|
||||
totalBytesRecv += _interface.BytesRecv
|
||||
totalBytesSent += _interface.BytesSent
|
||||
} else if _interface.Name == self.NetInterface {
|
||||
// ignore VPN interface or filter interface by name
|
||||
if (_interface.Name != "tun0" && self.NetInterface == "all") || (_interface.Name == self.NetInterface) {
|
||||
totalBytesRecv += _interface.BytesRecv
|
||||
totalBytesSent += _interface.BytesSent
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user