From 8648d4450e20581ccee3bba0f77d279868b2710a Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 29 Jul 2025 15:56:26 +0200 Subject: [PATCH] utils: Abstract built-in output check --- src/shell/mod.rs | 5 +---- src/utils/prelude.rs | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 6ddd844f..19c7b941 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -2042,10 +2042,7 @@ impl Shell { } pub fn builtin_output(&self) -> Option<&Output> { - self.outputs().find(|output| { - let name = output.name(); - name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-") - }) + self.outputs().find(|output| output.is_internal()) } pub fn global_space(&self) -> Rectangle { diff --git a/src/utils/prelude.rs b/src/utils/prelude.rs index bb30272a..45619003 100644 --- a/src/utils/prelude.rs +++ b/src/utils/prelude.rs @@ -22,6 +22,7 @@ use std::{ }; pub trait OutputExt { + fn is_internal(&self) -> bool; fn geometry(&self) -> Rectangle; fn zoomed_geometry(&self) -> Option>; @@ -44,6 +45,11 @@ struct VrrSupport(AtomicU8); struct Mirroring(Mutex>); impl OutputExt for Output { + fn is_internal(&self) -> bool { + let name = self.name(); + name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-") + } + fn geometry(&self) -> Rectangle { Rectangle::new(self.current_location(), { Transform::from(self.current_transform())