From 20363b498c3c39d984c38d3acf4b2cf59c251d9a Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Tue, 9 Jun 2026 15:14:02 +0200 Subject: [PATCH] Deduplicate output attach on init and log attached output name --- src/wayland.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/wayland.rs b/src/wayland.rs index 27ecacf..b00910b 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -168,14 +168,11 @@ pub fn run( let is_all = target_output == "all" || target_output == "*"; if is_all { - let wl_outputs: Vec<_> = state.output_state.outputs().collect(); - if wl_outputs.is_empty() { - // No outputs reported yet; let the compositor assign. + // OutputHandler::new_output already attached one layer per existing + // output during the roundtrip above. Only fall back to a compositor- + // assigned surface if none arrived. + if state.outputs.is_empty() { state.attach_output(&qh, None); - } else { - for wl_out in &wl_outputs { - state.attach_output(&qh, Some(wl_out)); - } } } else { let wl_out = find_output(&state.output_state, &target_output); @@ -343,6 +340,12 @@ impl OutputHandler for AppState { output: wl_output::WlOutput, ) { if self.target_output == "all" || self.target_output == "*" { + let name = self + .output_state + .info(&output) + .and_then(|i| i.name) + .unwrap_or_else(|| "".into()); + log::info!("attaching output: {}", name); self.attach_output(qh, Some(&output)); } }