ArgentumCation / mirafetch

European Union Public License 1.2
7 stars 5 forks source link

Fix Battery Detection on Linux #21

Open ArgentumCation opened 1 month ago

ArgentumCation commented 1 month ago

Expected behavior: Battery: 69% Actual behavior: Battery

ArgentumCation commented 3 weeks ago

https://github.com/ArgentumCation/mirafetch/blob/main/src/info/linuxinfo.rs#L441 We need to return None if the iterator is empty.

Also from @demize: image need to look into how this is handled /sys/class/power_supply/macsmc-battery/capacity seems to be the path we'd look for

find -L /sys/class/power_supply/* -maxdepth 1 -name capacity works without having to redirect stderr

the fast logic is probably to glob for capacity, validate type, then check capacity