tmux
tmux copied to clipboard
Enhancement: Add network upload/download speed
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
This sounds like a good idea, if you could implement it and send in a PR that'd be great!
Any issues with dependencies? Other solutions I've seen required additional installs.
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.
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).
Thanks for your thoughts. I came to the same conclusion, but also haven't been able to spend time on the enhancement.
@andrewsgreene : If you have a script which already does it, you might be interested in #163. Feedback welcome :grinning:.
Network-bandwidth is broken and not shows the network usage info
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}"
}
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
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
ok thanks
Solved in #233