chore: avoid duplicate updates when tray rate is off

This commit is contained in:
huzibaca 2025-01-14 11:48:43 +08:00
parent 1a61fab79a
commit fa86efcdfb
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302

View File

@ -316,6 +316,10 @@ impl Tray {
Some(traffic) = stream.next() => {
if let Ok(traffic) = traffic {
let guard = speed_rate.lock();
let enable_tray_speed: bool = Config::verge().latest().enable_tray_speed.unwrap_or(true);
if !enable_tray_speed {
continue;
}
if let Some(sr) = guard.as_ref() {
if let Some(rate) = sr.update_and_check_changed(traffic.up, traffic.down) {
let _ = Tray::global().update_icon(Some(rate));