Compare commits
2 commits
c60629864d
...
e8ff22d88c
Author | SHA1 | Date | |
---|---|---|---|
Stephen Seo | e8ff22d88c | ||
Stephen Seo | 3568bebb22 |
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -141,7 +141,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swaybar_info"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"regex",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "swaybar_info"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
edition = "2021"
|
||||
description = "Provides swaybar with info to be displayed"
|
||||
license = "MIT"
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
## Upcoming Changes
|
||||
|
||||
## 0.1.13
|
||||
|
||||
Fix to workaround when `acpi` output contains a `0%` line with "unavailable".
|
||||
When such a line is encountered, it is ignored.
|
||||
|
||||
## 0.1.12
|
||||
|
||||
Some refactoring of the code related to colorizing the netgraph.
|
||||
|
|
|
@ -127,7 +127,14 @@ impl BattInfo {
|
|||
cmd_builder.arg("-b");
|
||||
let output = cmd_builder.output()?;
|
||||
let string = String::from_utf8(output.stdout)?;
|
||||
let regex_captures_result = self.regex.captures(&string);
|
||||
let mut last_line = "unknown".to_owned();
|
||||
for line in string.lines() {
|
||||
if !line.contains("unavailable") {
|
||||
last_line = line.to_owned();
|
||||
break;
|
||||
}
|
||||
}
|
||||
let regex_captures_result = self.regex.captures(&last_line);
|
||||
if regex_captures_result.is_none() {
|
||||
self.acpi_error = true;
|
||||
return Err(Error::Generic("battinfo: regex captured nothing".into()));
|
||||
|
|
Loading…
Reference in a new issue