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.

chore: remove dead fields, unused methods, and stale comments

+16 -36
+1 -2
src/main.rs
··· 251 251 tray.set_paused(false); 252 252 tray.set_tooltip("ioma"); 253 253 if let Some(ref mgr) = overlay { 254 - mgr.window().set_unlock_input_visible(false); 255 - mgr.window().set_unlock_error("".into()); 254 + mgr.reset_unlock_state(); 256 255 mgr.hide(); 257 256 } 258 257 }
+5 -11
src/overlay/mod.rs
··· 1 1 pub mod password; 2 2 3 - use std::time::{Duration, Instant}; 3 + use std::time::Duration; 4 4 5 5 use slint::ComponentHandle; 6 6 ··· 9 9 10 10 pub struct OverlayManager { 11 11 window: OverlayWindow, 12 - break_duration: Duration, 13 - break_started: Instant, 14 12 } 15 13 16 14 impl OverlayManager { 17 15 pub fn new(is_dark: bool) -> anyhow::Result<Self> { 18 16 let w = OverlayWindow::new()?; 19 17 w.set_is_dark(is_dark); 20 - // Start hidden — shown only when a break fires. 21 18 w.hide().unwrap_or_default(); 22 - Ok(Self { 23 - window: w, 24 - break_duration: Duration::from_secs(300), 25 - break_started: Instant::now(), 26 - }) 19 + Ok(Self { window: w }) 27 20 } 28 21 29 22 pub fn show_break(&self, sched: &ScheduledBreak, is_enforced: bool, snooze_used: bool) { ··· 36 29 self.window.window().set_fullscreen(true); 37 30 } 38 31 39 - pub fn update_snooze_visible(&self, visible: bool) { 40 - self.window.set_snooze_visible(visible); 32 + pub fn reset_unlock_state(&self) { 33 + self.window.set_unlock_input_visible(false); 34 + self.window.set_unlock_error("".into()); 41 35 } 42 36 43 37 pub fn hide(&self) {
-3
src/settings/mod.rs
··· 68 68 Rc::clone(&self.levels_model) 69 69 } 70 70 71 - pub fn read_into(&self, cfg: &mut AppConfig) { 72 - read_settings_into(&self.window, &self.levels_model, cfg); 73 - } 74 71 } 75 72 76 73 /// Reads the settings window state back into `cfg`. Also usable from callbacks
+1 -2
src/timer/mod.rs
··· 70 70 ) -> (mpsc::UnboundedSender<TimerCommand>, std_mpsc::Receiver<TimerEvent>) { 71 71 let (cmd_tx, cmd_rx) = mpsc::unbounded_channel(); 72 72 let (event_tx, event_rx) = std_mpsc::channel(); 73 - let _ = cfg; // reserved for future use 73 + let _ = cfg; 74 74 75 75 let task = TimerTask { 76 76 scheduler: Scheduler::new(profile), ··· 200 200 break_duration: self.scheduler.profile().primary_level().break_duration, 201 201 label: self.scheduler.profile().primary_level().label.clone(), 202 202 is_long_break: false, 203 - level_index: Some(self.scheduler.profile().levels.len() - 1), 204 203 }) 205 204 } 206 205 }
+1 -2
src/timer/profile.rs
··· 27 27 28 28 #[derive(Debug, Clone)] 29 29 pub struct Profile { 30 - pub id: String, 31 30 pub name: String, 32 31 pub mode: BreakMode, 33 32 pub snooze_duration: Duration, ··· 60 59 label: lb.label.clone(), 61 60 }); 62 61 62 + let _ = id; 63 63 Self { 64 - id: id.to_string(), 65 64 name: cfg.name.clone(), 66 65 mode: match cfg.mode { 67 66 BreakModeConfig::Reminder => BreakMode::Reminder,
+8 -16
src/timer/scheduler.rs
··· 2 2 3 3 use super::profile::{BreakLevel, Profile}; 4 4 5 - /// Which break to fire, and its details. 6 5 #[derive(Debug, Clone)] 7 6 pub struct ScheduledBreak { 8 7 pub break_duration: Duration, 9 8 pub label: String, 10 9 pub is_long_break: bool, 11 - /// Index into Profile::levels (None for long break). 12 - pub level_index: Option<usize>, 13 10 } 14 11 15 12 /// Tracks elapsed work time and cycle counts to determine the next break. ··· 105 102 self.last_break_ended = Some(Instant::now()); 106 103 } 107 104 108 - #[allow(dead_code)] 109 - pub fn work_elapsed(&self) -> Duration { 110 - self.work_elapsed 111 - } 112 - 113 - pub fn primary_cycle_count(&self) -> u32 { 114 - self.primary_cycle_count 115 - } 116 - 117 105 /// Seconds until the next break fires (for tray label). 118 106 pub fn secs_until_next_break(&self) -> u64 { 119 107 if let Some(idx) = self.next_break_level_index() { ··· 142 130 break_duration: lb.break_duration, 143 131 label: lb.label.clone(), 144 132 is_long_break: true, 145 - level_index: None, 146 133 }); 147 134 } 148 135 } 149 136 150 137 // Find the highest-priority (longest interval) level that is due. 151 - for (idx, level) in self.profile.levels.iter().enumerate().rev() { 138 + for (_idx, level) in self.profile.levels.iter().enumerate().rev() { 152 139 if self.work_elapsed >= level.work_duration { 153 140 return Some(ScheduledBreak { 154 141 break_duration: level.break_duration, 155 142 label: level.label.clone(), 156 143 is_long_break: false, 157 - level_index: Some(idx), 158 144 }); 159 145 } 160 146 } ··· 174 160 } 175 161 176 162 #[cfg(test)] 163 + impl Scheduler { 164 + pub fn primary_cycle_count(&self) -> u32 { 165 + self.primary_cycle_count 166 + } 167 + } 168 + 169 + #[cfg(test)] 177 170 mod tests { 178 171 use super::*; 179 172 use crate::timer::profile::{BreakLevel, BreakMode, LongBreakTrigger, Profile}; 180 173 181 174 fn make_profile(levels: Vec<(u64, u64)>, long: Option<(u32, u64, u64)>) -> Profile { 182 175 Profile { 183 - id: "test".to_string(), 184 176 name: "Test".to_string(), 185 177 mode: BreakMode::Reminder, 186 178 snooze_duration: Duration::from_secs(300),