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.

refactor: eliminate duplicated session, monitor, and layer checks

+14 -15
+14 -15
src/overlay/mod.rs
··· 63 63 ); 64 64 65 65 #[cfg(target_os = "linux")] 66 - let layer_barrier: Option<LayerShellBarrier> = if session == SessionType::Wayland { 67 - let primary = all_monitors.iter().find(|m| m.is_primary); 68 - let (px, py) = primary.map(|m| (m.x, m.y)).unwrap_or((0, 0)); 69 - LayerShellBarrier::try_new(px, py) 70 - } else { 71 - None 72 - }; 66 + let layer_barrier = build_layer_barrier(&all_monitors); 73 67 74 68 let is_enforced = Arc::new(AtomicBool::new(false)); 75 69 let backend = Box::new(multi_slint::MultiSlintBackend::new( ··· 153 147 fn rebuild(&mut self) { 154 148 #[cfg(target_os = "linux")] 155 149 { 156 - let session = session::detect(); 157 - self.layer_barrier = if session == SessionType::Wayland { 158 - let primary = self.known_monitors.iter().find(|m| m.is_primary); 159 - let (px, py) = primary.map(|m| (m.x, m.y)).unwrap_or((0, 0)); 160 - LayerShellBarrier::try_new(px, py) 161 - } else { 162 - None 163 - }; 150 + self.layer_barrier = build_layer_barrier(&self.known_monitors); 164 151 } 165 152 166 153 match multi_slint::MultiSlintBackend::new( ··· 178 165 Err(e) => log::warn!("overlay: monitor rebuild failed: {e}"), 179 166 } 180 167 } 168 + } 169 + 170 + // ── Private helpers ────────────────────────────────────────────────────────── 171 + 172 + #[cfg(target_os = "linux")] 173 + fn build_layer_barrier(monitors: &[monitors::MonitorInfo]) -> Option<LayerShellBarrier> { 174 + if session::detect() != SessionType::Wayland { 175 + return None; 176 + } 177 + let primary = monitors.iter().find(|m| m.is_primary); 178 + let (px, py) = primary.map(|m| (m.x, m.y)).unwrap_or((0, 0)); 179 + LayerShellBarrier::try_new(px, py) 181 180 } 182 181 183 182 // ── Shared helpers ───────────────────────────────────────────────────────────