I have to admit that the (in)famous Lens functionalities (except the amazon-drive one) have let me try once more the ubuntu-unity user interface.
I obviously do miss gnome-extensions...
I felt indicator-sysmonitor could mitigate my blues, but its code can't properly handle the presence of 2 interfaces: in the panel net traffic was always 0kB/s in download as well in upload.
Luckly enough, indicator-sysmonitor is written in python (and it is open source)!
So take a look /usr/bin/indicator-sysmonitor: near line 278 the function _fetch_net(self) has hardcoded to use the 4th and 5th value of ifstat. But if there are more than one network interface the one has to use 8th and 9th value.
0.00 0.00 26.12 12.00 0.00 0.00 26.12 12.00
the first two values being lo the local loopback, the second pair being eth0, the third one wlan0, the last pair the total.
So if this is your case, you has to change by hand the code (reckon from 2 as awk arguments: $8 and $9 are the 7h and 8th values):
I obviously do miss gnome-extensions...
I felt indicator-sysmonitor could mitigate my blues, but its code can't properly handle the presence of 2 interfaces: in the panel net traffic was always 0kB/s in download as well in upload.
Luckly enough, indicator-sysmonitor is written in python (and it is open source)!
So take a look /usr/bin/indicator-sysmonitor: near line 278 the function _fetch_net(self) has hardcoded to use the 4th and 5th value of ifstat. But if there are more than one network interface the one has to use 8th and 9th value.
ifstat -a -n -q -S -T 0.5 1 |tail -1(which is used by indicator-sysmonitor) outputs a line very similar to the following
0.00 0.00 26.12 12.00 0.00 0.00 26.12 12.00
the first two values being lo the local loopback, the second pair being eth0, the third one wlan0, the last pair the total.
So if this is your case, you has to change by hand the code (reckon from 2 as awk arguments: $8 and $9 are the 7h and 8th values):
def _fetch_net(self):
"""It use the command "ifstat" to know the total net usage"""
total_net = subprocess.Popen(
"ifstat -a -n -q -S -T 0.5 1 | tail -1 | awk \
'{ printf(\"↓%dkB/s ↑%dkB/s\", $8, $9) }'",
stdout=subprocess.PIPE, shell=True).communicate()[0].strip()
return total_net
Nessun commento:
Posta un commento