some fixes
This commit is contained in:
parent
db26355b41
commit
af84040321
|
@ -52,6 +52,11 @@ fn battery_info(width_to: usize) -> String
|
||||||
|
|
||||||
let mut percentage = String::new();
|
let mut percentage = String::new();
|
||||||
let _ = file.read_to_string(&mut percentage);
|
let _ = file.read_to_string(&mut percentage);
|
||||||
|
|
||||||
|
if percentage.ends_with('\n')
|
||||||
|
{
|
||||||
|
percentage.pop();
|
||||||
|
}
|
||||||
|
|
||||||
let status_path = bat_path.join("status");
|
let status_path = bat_path.join("status");
|
||||||
let mut file = match File::open(&status_path) {
|
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")
|
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
|
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