some fixes
This commit is contained in:
parent
db26355b41
commit
af84040321
|
@ -53,6 +53,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) {
|
||||
Err(why) => panic!("couldn't open {}: {}", status_path.display(), why),
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user