From cd90dfc7be11147936c2b637ae822ff0adf5a7b7 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 5 Nov 2024 09:40:54 +0300 Subject: Disable laptop panel when the lid is closed --- src/backend/tty.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/backend/tty.rs') diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 58face27..5da9a604 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -783,6 +783,10 @@ impl Tty { debug!("output is disabled in the config"); return Ok(()); } + if !niri.should_enable_laptop_panel(&output_name.connector) { + debug!("output is disabled because it is a laptop panel and the lid is closed"); + return Ok(()); + } for m in connector.modes() { trace!("{m:?}"); @@ -1723,7 +1727,7 @@ impl Tty { .find(&surface.name) .cloned() .unwrap_or_default(); - if config.off { + if config.off || !niri.should_enable_laptop_panel(&surface.name.connector) { to_disconnect.push((node, crtc)); continue; } @@ -1833,7 +1837,7 @@ impl Tty { .cloned() .unwrap_or_default(); - if !config.off { + if !config.off && niri.should_enable_laptop_panel(&output_name.connector) { to_connect.push((node, connector.clone(), crtc)); } } -- cgit