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: start on open don't pause

+6 -3
+6 -3
src/app.rs
··· 47 47 .spawn(move || { 48 48 let mut detector = idle::create(); 49 49 let mut was_idle = false; 50 + let mut had_successful_reading = false; 50 51 51 52 loop { 52 53 std::thread::sleep(Duration::from_secs(5)); 53 54 54 55 match detector.idle_duration() { 55 56 Ok(Some(idle_dur)) if idle_dur >= threshold => { 57 + had_successful_reading = true; 56 58 if !was_idle { 57 59 was_idle = true; 58 60 let _ = cmd_tx.send(TimerCommand::IdleDetected { duration: idle_dur }); ··· 60 62 } 61 63 Ok(Some(_)) => { 62 64 // Idle time is below threshold — user is actively present. 65 + had_successful_reading = true; 63 66 if was_idle { 64 67 was_idle = false; 65 68 let _ = cmd_tx.send(TimerCommand::Resume); ··· 67 70 } 68 71 Ok(None) => { 69 72 // Could not query idle time (session bus unavailable, display gone, etc.). 70 - // Treat as maximally idle so the timer stays paused rather than firing 71 - // breaks while the user is logged out. 72 - if !was_idle { 73 + // Only treat as idle if we had a prior successful reading — this avoids 74 + // pausing on startup before the session bus is fully available. 75 + if had_successful_reading && !was_idle { 73 76 was_idle = true; 74 77 let _ = cmd_tx.send(TimerCommand::IdleDetected { 75 78 duration: Duration::from_secs(u64::MAX),