From e5b0c1a8d430ed061ab472f4172b38a6cc961405 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 19 Sep 2026 09:16:06 +0300 Subject: [PATCH] Compute exclusive layer-shell focus in render order Before, with two surfaces, the one below would keep keyboard focus instead of the one on top. This is weird and also inconsistent with pointer focus. The on-demand change doesn't affect the logic but is good for consistency to avoid mistakes going forward. --- src/niri.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/niri.rs b/src/niri.rs index e110953c..6df2a895 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1297,7 +1297,7 @@ impl State { }; let excl_focus_on_layer = |layer| { - layers.layers_on(layer).find_map(|surface| { + layers.layers_on(layer).rev().find_map(|surface| { if surface.cached_state().keyboard_interactivity != wlr_layer::KeyboardInteractivity::Exclusive { @@ -1315,7 +1315,7 @@ impl State { }; let on_d_focus_on_layer = |layer| { - layers.layers_on(layer).find_map(|surface| { + layers.layers_on(layer).rev().find_map(|surface| { let is_on_demand_surface = Some(surface) == self.niri.layer_shell_on_demand_focus.as_ref(); is_on_demand_surface