Merge pull request #212 from pop-os/battery-handle-udev-change

battery: Re-evaluate gpu state on udev change event
This commit is contained in:
Victoria Brekenfeld 2024-02-07 21:10:25 +01:00 committed by GitHub
commit d292246032
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -466,6 +466,13 @@ async fn start_listening(
});
}
},
EventType::Change => {
if let Some(path) = event.devnode() {
if let Some(gpu) = monitor.gpus.iter_mut().find(|gpu| gpu.path == path) {
gpu.interval.reset_immediately();
}
}
}
EventType::Remove => {
if let Some(path) = event.devnode() {
monitor.gpus.retain(|gpu| gpu.path != path);