a lightweight, interval-based utility to combat digital strain through "Ma" (intentional pauses) for the eyes and body.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: apply setting changes immediately for enforced mode

+10 -4
+10 -4
src/main.rs
··· 60 60 61 61 let tray = Rc::new(AppTray::new()?); 62 62 let is_dark = cfg.appearance.overlay_theme == config::OverlayTheme::Dark; 63 - let is_enforced = active_profile(&cfg).mode == BreakMode::Enforced; 64 63 let sound_enabled = cfg.appearance.sound_enabled; 65 64 let sound_volume = cfg.appearance.sound_volume; 66 65 let active_profile_name = active_profile(&cfg).name.clone(); ··· 199 198 // Unlock button: show password prompt in enforced, dismiss in reminder. 200 199 let tx = cmd_tx.clone(); 201 200 let win_unlock = mgr.window().clone_strong(); 201 + let cfg_arc_unlock = cfg_arc.clone(); 202 202 mgr.window().on_unlock_clicked(move || { 203 - if is_enforced { 203 + let enforced = active_profile(&cfg_arc_unlock.lock().unwrap()).mode == BreakMode::Enforced; 204 + if enforced { 204 205 win_unlock.set_unlock_input_visible(true); 205 206 win_unlock.set_unlock_error("".into()); 206 207 } else { ··· 212 213 let win_submit = mgr.window().clone_strong(); 213 214 let cfg_arc_ov = cfg_arc.clone(); 214 215 mgr.window().on_unlock_submit_clicked(move |password| { 215 - let hash = cfg_arc_ov.lock().unwrap().enforced.password_hash.clone(); 216 + let cfg = cfg_arc_ov.lock().unwrap(); 217 + let hash = cfg.enforced.password_hash.clone(); 218 + drop(cfg); 216 219 if overlay::password::verify_password(password.as_str(), &hash) { 217 220 win_submit.set_unlock_input_visible(false); 218 221 win_submit.set_unlock_error("".into()); ··· 222 225 } 223 226 }); 224 227 // Block OS close (Alt+F4) in enforced mode. 228 + let cfg_arc_close = cfg_arc.clone(); 225 229 mgr.window().window().on_close_requested(move || { 226 - if is_enforced { 230 + let enforced = active_profile(&cfg_arc_close.lock().unwrap()).mode == BreakMode::Enforced; 231 + if enforced { 227 232 slint::CloseRequestResponse::KeepWindowShown 228 233 } else { 229 234 slint::CloseRequestResponse::HideWindow ··· 236 241 } 237 242 238 243 if let Some(ref mgr) = overlay { 244 + let is_enforced = active_profile(&cfg_arc.lock().unwrap()).mode == BreakMode::Enforced; 239 245 mgr.show_break(&sched, is_enforced, snooze_used); 240 246 } 241 247 }