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.

feat: enrforce overlay lock with password verify

+32 -1
+32 -1
src/main.rs
··· 196 196 mgr.window().on_snooze_clicked(move || { 197 197 let _ = tx.send(TimerCommand::BreakEnded { snoozed: true }); 198 198 }); 199 + // Unlock button: show password prompt in enforced, dismiss in reminder. 199 200 let tx = cmd_tx.clone(); 201 + let win_unlock = mgr.window().clone_strong(); 200 202 mgr.window().on_unlock_clicked(move || { 201 - let _ = tx.send(TimerCommand::BreakEnded { snoozed: false }); 203 + if is_enforced { 204 + win_unlock.set_unlock_input_visible(true); 205 + win_unlock.set_unlock_error("".into()); 206 + } else { 207 + let _ = tx.send(TimerCommand::BreakEnded { snoozed: false }); 208 + } 209 + }); 210 + // Password submitted: verify; dismiss on success, show error on failure. 211 + let tx = cmd_tx.clone(); 212 + let win_submit = mgr.window().clone_strong(); 213 + let cfg_arc_ov = cfg_arc.clone(); 214 + mgr.window().on_unlock_submit_clicked(move |password| { 215 + let hash = cfg_arc_ov.lock().unwrap().enforced.password_hash.clone(); 216 + if overlay::password::verify_password(password.as_str(), &hash) { 217 + win_submit.set_unlock_input_visible(false); 218 + win_submit.set_unlock_error("".into()); 219 + let _ = tx.send(TimerCommand::BreakEnded { snoozed: false }); 220 + } else { 221 + win_submit.set_unlock_error("Incorrect password.".into()); 222 + } 223 + }); 224 + // Block OS close (Alt+F4) in enforced mode. 225 + mgr.window().window().on_close_requested(move || { 226 + if is_enforced { 227 + slint::CloseRequestResponse::KeepWindowShown 228 + } else { 229 + slint::CloseRequestResponse::HideWindow 230 + } 202 231 }); 203 232 overlay = Some(mgr); 204 233 } ··· 216 245 tray.set_paused(false); 217 246 tray.set_tooltip("ioma"); 218 247 if let Some(ref mgr) = overlay { 248 + mgr.window().set_unlock_input_visible(false); 249 + mgr.window().set_unlock_error("".into()); 219 250 mgr.hide(); 220 251 } 221 252 }