neiam
/koco
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
re-fmt
07c9619 · gmorell · 2026-01-12 02:47
Files changed
modified
src/main.rs
+12
−11
@@ -1255,17 +1255,18 @@ impl eframe::App for Koco {
| 1255 | 1255 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { |
| 1256 | 1256 | // Check if theme was changed via MQTT and reload config + apply theme |
| 1257 | 1257 | if let Ok(mut changed) = self.theme_changed.lock() |
| 1258 | − && *changed { | |
| 1259 | − *changed = false; | |
| 1260 | − // Reload config from disk | |
| 1261 | − self.config = KocoConfig::load(); | |
| 1262 | − // Apply the new theme | |
| 1263 | − self.apply_theme(ctx); | |
| 1264 | − // Update UI state to match | |
| 1265 | − self.config_ui_state.load_mqtt_config(&self.config); | |
| 1266 | − // Request repaint to apply visual changes | |
| 1267 | − ctx.request_repaint(); | |
| 1268 | − } | |
| 1258 | + && *changed | |
| 1259 | + { | |
| 1260 | + *changed = false; | |
| 1261 | + // Reload config from disk | |
| 1262 | + self.config = KocoConfig::load(); | |
| 1263 | + // Apply the new theme | |
| 1264 | + self.apply_theme(ctx); | |
| 1265 | + // Update UI state to match | |
| 1266 | + self.config_ui_state.load_mqtt_config(&self.config); | |
| 1267 | + // Request repaint to apply visual changes | |
| 1268 | + ctx.request_repaint(); | |
| 1269 | + } | |
| 1269 | 1270 | |
| 1270 | 1271 | // Request periodic repaints to check for MQTT theme updates |
| 1271 | 1272 | if self.config.mqtt_enabled { |
Parents: fb115f1