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(ui): overlay now covers full screen on windows

+8 -34
+8 -34
src/overlay/multi_slint.rs
··· 2 2 use std::time::Duration; 3 3 4 4 use slint::ComponentHandle; 5 - #[cfg(target_os = "linux")] 5 + #[cfg(any(target_os = "linux", target_os = "windows"))] 6 6 use slint::winit_030::{WinitWindowAccessor, winit}; 7 7 8 8 use crate::app::active_profile; ··· 16 16 struct WindowEntry { 17 17 window: OverlayWindow, 18 18 pos: slint::LogicalPosition, 19 - /// Only needed on non-Linux where we size windows explicitly. 20 - #[cfg(not(target_os = "linux"))] 21 - size: slint::LogicalSize, 22 - /// Index of this window in the list of monitors sorted by (x, y). Used as 23 - /// a fallback when position-based monitor matching fails. 24 19 monitor_index: usize, 25 20 } 26 21 ··· 55 50 x: monitor.x as f32, 56 51 y: monitor.y as f32, 57 52 }; 58 - #[cfg(not(target_os = "linux"))] 59 - let size = slint::LogicalSize { 60 - width: monitor.width as f32, 61 - height: monitor.height as f32, 62 - }; 63 53 let w = OverlayWindow::new()?; 64 54 w.set_is_dark(is_dark); 65 55 wire_callbacks(&w, cmd_tx.clone(), cfg_arc.clone()); ··· 67 57 entries.push(WindowEntry { 68 58 window: w, 69 59 pos, 70 - #[cfg(not(target_os = "linux"))] 71 - size, 72 60 monitor_index: *sort_rank, 73 61 }); 74 62 } ··· 114 102 .set_countdown_text(fmt_dur(sched.break_duration).as_str().into()); 115 103 e.window.set_progress(0.0); 116 104 117 - #[cfg(target_os = "linux")] 105 + #[cfg(any(target_os = "linux", target_os = "windows"))] 118 106 { 119 - // On both X11 and Wayland, use winit's monitor-specific fullscreen: 120 - // X11: _NET_WM_FULLSCREEN_MONITORS via RandR 121 - // Wayland: xdg_toplevel.set_fullscreen(wl_output) 122 - // Setting position/size before show() is unreliable on both backends; 123 - // this async approach waits until the window handle is live, then 124 - // targets the correct output by matching our enumerated positions. 107 + // Set fullscreen before show() so the window appears at screen size 108 + // immediately — avoids a small-window flash that can clip the UI 109 + // (including the snooze button) before the async winit task fires. 110 + // The async task below then pins the window to the correct monitor. 125 111 let target_pos = e.pos; 126 112 let monitor_idx = e.monitor_index; 127 113 let win_weak = e.window.as_weak(); 114 + e.window.window().set_fullscreen(true); 128 115 e.window.show().unwrap_or_default(); 129 116 slint::spawn_local(async move { 130 117 let Some(overlay) = win_weak.upgrade() else { ··· 134 121 Ok(w) => w, 135 122 Err(_) => { 136 123 log::warn!( 137 - "overlay: winit_window() unavailable for ({},{}) — falling back", 124 + "overlay: winit_window() unavailable for ({},{}) — already fullscreen", 138 125 target_pos.x, 139 126 target_pos.y 140 127 ); 141 - overlay.window().set_fullscreen(true); 142 128 return; 143 129 } 144 130 }; ··· 191 177 winit_win.set_fullscreen(Some(winit::window::Fullscreen::Borderless(handle))); 192 178 }) 193 179 .ok(); 194 - } 195 - 196 - #[cfg(not(target_os = "linux"))] 197 - { 198 - // Windows: explicit position+size is reliable. 199 - e.window 200 - .window() 201 - .set_position(slint::WindowPosition::Logical(e.pos)); 202 - e.window 203 - .window() 204 - .set_size(slint::WindowSize::Logical(e.size)); 205 - e.window.show().unwrap_or_default(); 206 180 } 207 181 } 208 182 }