diff --git a/src/main.rs b/src/main.rs index 8a0f6e6..e43f7ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,9 +18,10 @@ use log::debug; use std::sync::LazyLock; static PLS: LazyLock = LazyLock::new(|| { - let (supports_gfx, window) = match (is_supported(), Window::try_new()) { - (true, Some(window)) => (true, Some(window)), - _ => (false, None), + let window = Window::try_new(); + let supports_gfx = match &window { + Some(win) if win.ws_xpixel > 0 && win.ws_ypixel > 0 => is_supported(), + _ => false, }; Pls { diff --git a/src/models/window.rs b/src/models/window.rs index 6df64f7..ea14a72 100644 --- a/src/models/window.rs +++ b/src/models/window.rs @@ -19,7 +19,7 @@ impl Window { let mut win = Self::default(); #[allow(clippy::useless_conversion)] let r = unsafe { ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut win) }; - if r == 0 && win.ws_xpixel > win.ws_col && win.ws_ypixel > win.ws_row { + if r == 0 && win.ws_row > 0 && win.ws_col > 0 { return Some(win); } warn!("Could not determine cell dimensions.");