better layout

This commit is contained in:
Özgür Kesim 2022-01-30 22:24:52 +01:00
parent e33174c0bd
commit 840f2ff5fd
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ pub async fn get_cpu_temp() -> ThreadsData {
let value = buf.trim().parse::<f32>().unwrap(); let value = buf.trim().parse::<f32>().unwrap();
let result = format!( let result = format!(
" {} {}° {}", " {} {: <3.1}° {}",
CONFIG.cpu_temperature.icon, CONFIG.cpu_temperature.icon,
value / 1000.0, value / 1000.0,
CONFIG.seperator CONFIG.seperator

View File

@ -18,7 +18,7 @@ pub async fn get_netspeed() -> ThreadsData {
let rx = calculate(rx_bps); let rx = calculate(rx_bps);
let data = format!( let data = format!(
"{}{} {}{} {}", " {}{} {}{} {}",
rx, CONFIG.netspeed.recieve_icon, tx, CONFIG.netspeed.transmit_icon, CONFIG.seperator rx, CONFIG.netspeed.recieve_icon, tx, CONFIG.netspeed.transmit_icon, CONFIG.seperator
); );
ThreadsData::NetSpeed(data) ThreadsData::NetSpeed(data)
@ -36,7 +36,7 @@ fn parse_speed_file(pth: &str) -> u64 {
} }
fn calculate(speed: u64) -> String { fn calculate(speed: u64) -> String {
let lookup = ["B", "kB", "MB"]; let lookup = ["b", "kb", "Mb"];
let mut speed = speed as f64; let mut speed = speed as f64;
let mut idx = 0; let mut idx = 0;
while speed >= 1024.0 && idx < lookup.len() { while speed >= 1024.0 && idx < lookup.len() {