Skip to content

Commit decf070

Browse files
authored
fix(linux-rust): Clear stale tray battery on device switch (#447)
1 parent 7ab8bd7 commit decf070

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

linux-rust/src/devices/airpods.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ impl AirPodsDevice {
3434

3535
if let Some(handle) = &tray_handle {
3636
handle
37-
.update(|tray: &mut MyTray| tray.connected = true)
37+
.update(|tray: &mut MyTray| {
38+
tray.connected = true;
39+
tray.battery_headphone = None;
40+
tray.battery_headphone_status = None;
41+
tray.battery_l = None;
42+
tray.battery_l_status = None;
43+
tray.battery_r = None;
44+
tray.battery_r_status = None;
45+
tray.battery_c = None;
46+
tray.battery_c_status = None;
47+
})
3848
.await;
3949
}
4050

0 commit comments

Comments
 (0)