Skip to content

Commit 8648d44

Browse files
committed
utils: Abstract built-in output check
1 parent d6c1ca8 commit 8648d44

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/shell/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,10 +2042,7 @@ impl Shell {
20422042
}
20432043

20442044
pub fn builtin_output(&self) -> Option<&Output> {
2045-
self.outputs().find(|output| {
2046-
let name = output.name();
2047-
name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-")
2048-
})
2045+
self.outputs().find(|output| output.is_internal())
20492046
}
20502047

20512048
pub fn global_space(&self) -> Rectangle<i32, Global> {

src/utils/prelude.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::{
2222
};
2323

2424
pub trait OutputExt {
25+
fn is_internal(&self) -> bool;
2526
fn geometry(&self) -> Rectangle<i32, Global>;
2627
fn zoomed_geometry(&self) -> Option<Rectangle<i32, Global>>;
2728

@@ -44,6 +45,11 @@ struct VrrSupport(AtomicU8);
4445
struct Mirroring(Mutex<Option<WeakOutput>>);
4546

4647
impl OutputExt for Output {
48+
fn is_internal(&self) -> bool {
49+
let name = self.name();
50+
name.starts_with("eDP-") || name.starts_with("LVDS-") || name.starts_with("DSI-")
51+
}
52+
4753
fn geometry(&self) -> Rectangle<i32, Global> {
4854
Rectangle::new(self.current_location(), {
4955
Transform::from(self.current_transform())

0 commit comments

Comments
 (0)