netspeed layout improved

This commit is contained in:
Özgür Kesim 2022-01-29 23:23:26 +01:00
parent 6901ac4b4f
commit e33174c0bd

View File

@ -18,8 +18,8 @@ pub async fn get_netspeed() -> ThreadsData {
let rx = calculate(rx_bps); let rx = calculate(rx_bps);
let data = format!( let data = format!(
" {} {} {} {} {}", "{}{} {}{} {}",
CONFIG.netspeed.recieve_icon, rx, CONFIG.netspeed.transmit_icon, tx, CONFIG.seperator rx, CONFIG.netspeed.recieve_icon, tx, CONFIG.netspeed.transmit_icon, CONFIG.seperator
); );
ThreadsData::NetSpeed(data) ThreadsData::NetSpeed(data)
} }
@ -43,5 +43,5 @@ fn calculate(speed: u64) -> String {
speed /= 1024.0; speed /= 1024.0;
idx += 1; idx += 1;
} }
format!("{:.1} {}", speed, lookup[idx]) format!("{: >5.1}{: >2}", speed, lookup[idx])
} }