Merge branch 'rust_rewrite' of git.mcorangehq.xyz:XOR64/dim into rust_rewrite

This commit is contained in:
Gvidas Juknevičius 2024-06-17 14:13:11 +03:00
commit 8693e10979
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB

View File

@ -23,7 +23,7 @@ impl DimPlugin for Plug {
fn init(&mut self) {
}
fn poll(&mut self, f: &mut dim_sdk::CBuffer) -> dim_sdk::Result<()> {
let contents = read_to_string("/home/xomf/battery_test")?;
let contents = read_to_string("/sys/class/power_supply/BAT0/capacity")?;
let cleaned_contents: String = contents.chars().filter(|c| c.is_digit(10)).collect();
write!(f, "Battery: {}%", cleaned_contents)?;