mirror of
https://github.com/polybar/polybar.git
synced 2026-03-01 05:19:54 +00:00
feat(net): %netspeed% token to show combined up+download speed (#2590)
Closes #1083 * Add netspeed parameter (#1083) * Update net.cpp * Update net.hpp * Update network.cpp * Update CHANGELOG.md
This commit is contained in:
@ -274,6 +274,15 @@ namespace net {
|
||||
float bytes_diff = m_status.current.transmitted - m_status.previous.transmitted;
|
||||
return format_speedrate(bytes_diff, minwidth, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total net speed rate
|
||||
*/
|
||||
string network::netspeed(int minwidth, const string& unit) const {
|
||||
float bytes_diff = m_status.current.received - m_status.previous.received
|
||||
+ m_status.current.transmitted - m_status.previous.transmitted;
|
||||
return format_speedrate(bytes_diff, minwidth, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if unknown counts as up
|
||||
|
||||
Reference in New Issue
Block a user