tmux icon indicating copy to clipboard operation
tmux copied to clipboard

Enhancement: Add network upload/download speed

Open andrewg-xyz opened this issue 3 years ago • 6 comments

Describe the feature you'd like

To the status bar, add an option for network up/down. Showing CPU, RAM, GPU usage is amazing, with network usage this theme would be perfect.

Describe risks you've considered

none.

Describe alternatives you've considered

Forking this repository, using a different theme

andrewg-xyz avatar Mar 10 '21 01:03 andrewg-xyz

This sounds like a good idea, if you could implement it and send in a PR that'd be great!

ethancedwards8 avatar Mar 12 '21 14:03 ethancedwards8

Any issues with dependencies? Other solutions I've seen required additional installs.

andrewg-xyz avatar Mar 12 '21 15:03 andrewg-xyz

Any issues with dependencies? Other solutions I've seen required additional installs.

Yeah that is a concern, we want to keep it bash only and just using tools like sed, awk, and grep.

ethancedwards8 avatar Mar 12 '21 17:03 ethancedwards8

Without external tools it is almost impossible to reliable measure download/upload speed. I would recommend speedtest-cli (quasi standard in measuring internet speed), it is automatically finds the closest server and it is reliable. In docs we can add a note for this plugin that it needs speedtest-cli and in script we can check if it is installed (installation is simple as pip install speedtest-cli), if not display a message to install it first.

Also I don't recommend frequent updates, default rate should be minimum 1 hour (data consumption is 50-100MB/test).

adrianmihalko avatar Dec 22 '21 23:12 adrianmihalko

Thanks for your thoughts. I came to the same conclusion, but also haven't been able to spend time on the enhancement.

andrewg-xyz avatar Jan 11 '22 14:01 andrewg-xyz

@andrewsgreene : If you have a script which already does it, you might be interested in #163. Feedback welcome :grinning:.

pataquets avatar Jul 10 '22 18:07 pataquets

Network-bandwidth is broken and not shows the network usage info

ciscohack avatar Feb 04 '23 17:02 ciscohack

Network-bandwidth is broken and not shows the network usage info

@ciscohack looks like you don't have installed bc. try 2 install bc

get_bandwidth() {
  upload="$(interface_bytes "$1" "tx")"
  download="$(interface_bytes "$1" "rx")"

  #wait the interval for Wait for interval to calculate the difference
  sleep "$INTERVAL"

  upload="$(bc <<<"$(interface_bytes "$1" "tx") - $upload")"
  download="$(bc <<<"$(interface_bytes "$1" "rx") - $download")"

  #set to 0 by default useful for non-existent interface
  echo "${upload:-0} ${download:-0}"
}

dashorty avatar Oct 01 '23 07:10 dashorty

Network-bandwidth is broken and not shows the network usage info

@ciscohack looks like you don't have installed bc. try 2 install bc

get_bandwidth() {
  upload="$(interface_bytes "$1" "tx")"
  download="$(interface_bytes "$1" "rx")"

  #wait the interval for Wait for interval to calculate the difference
  sleep "$INTERVAL"

  upload="$(bc <<<"$(interface_bytes "$1" "tx") - $upload")"
  download="$(bc <<<"$(interface_bytes "$1" "rx") - $download")"

  #set to 0 by default useful for non-existent interface
  echo "${upload:-0} ${download:-0}"
}

I do have BC tool installed .. where do I put this function my friend... thanks for response

ciscohack avatar Oct 01 '23 10:10 ciscohack

oh ok. This is already in the code: https://github.com/dracula/tmux/blob/ff254288685df64592b028c77b8f499dbf0a5b82/scripts/network_bandwidth.sh#L41-L53

Try to run the script in your terminal (in a tmux session!)

~/.tmux/plugins/tmux/scripts/network_bandwidth.sh

dashorty avatar Oct 01 '23 10:10 dashorty

ok thanks

ciscohack avatar Oct 01 '23 12:10 ciscohack

Solved in #233

ethancedwards8 avatar Oct 02 '23 19:10 ethancedwards8