mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
battery: case-insensitive matching for peripherals
This commit is contained in:
parent
4e03679209
commit
e6b7f3eb34
1 changed files with 10 additions and 7 deletions
|
@ -604,14 +604,17 @@ pub fn get_battery_info(config: &AppConfig) -> Result<Vec<BatteryInfo>> {
|
||||||
|
|
||||||
/// Check if a battery is likely a peripheral (mouse, keyboard, etc) not a laptop battery
|
/// Check if a battery is likely a peripheral (mouse, keyboard, etc) not a laptop battery
|
||||||
fn is_peripheral_battery(ps_path: &Path, name: &str) -> bool {
|
fn is_peripheral_battery(ps_path: &Path, name: &str) -> bool {
|
||||||
|
// Convert name to lowercase once for case-insensitive matching
|
||||||
|
let name_lower = name.to_lowercase();
|
||||||
|
|
||||||
// Common peripheral battery names
|
// Common peripheral battery names
|
||||||
if name.contains("mouse")
|
if name_lower.contains("mouse")
|
||||||
|| name.contains("keyboard")
|
|| name_lower.contains("keyboard")
|
||||||
|| name.contains("trackpad")
|
|| name_lower.contains("trackpad")
|
||||||
|| name.contains("gamepad")
|
|| name_lower.contains("gamepad")
|
||||||
|| name.contains("controller")
|
|| name_lower.contains("controller")
|
||||||
|| name.contains("headset")
|
|| name_lower.contains("headset")
|
||||||
|| name.contains("headphone")
|
|| name_lower.contains("headphone")
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue