some fixes

This commit is contained in:
Daniel Knuettel 2024-04-16 20:58:30 +02:00
parent db26355b41
commit af84040321

View File

@ -52,6 +52,11 @@ fn battery_info(width_to: usize) -> String
let mut percentage = String::new();
let _ = file.read_to_string(&mut percentage);
if percentage.ends_with('\n')
{
percentage.pop();
}
let status_path = bat_path.join("status");
let mut file = match File::open(&status_path) {
@ -63,11 +68,11 @@ fn battery_info(width_to: usize) -> String
if status.contains("Charging") || status.contains("Full")
{
fixed_width(&format!("{SYMB_POWER} {percentage}%"), width_to + 1)
fixed_width(&format!("{SYMB_POWER} {percentage}%"), width_to)
}
else
{
fixed_width(&format!("{SYMB_BATT} {percentage}%"), width_to)
fixed_width(&format!("{SYMB_BATT} {percentage}%"), width_to - 1)
}
}