From 1737a58b01922584863b0eaa9c4735fa96527619 Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Mon, 15 Sep 2025 15:27:04 +0200 Subject: [PATCH] Initially focus the lock surface that has the current output focus --- sway/lock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sway/lock.c b/sway/lock.c index a75c1e7e..2b9b74b0 100644 --- a/sway/lock.c +++ b/sway/lock.c @@ -8,6 +8,7 @@ #include "sway/layers.h" #include "sway/output.h" #include "sway/server.h" +#include "sway/tree/workspace.h" #include "sway/lock.h" struct sway_session_lock_output { @@ -78,7 +79,15 @@ void sway_session_lock_focus_output(struct sway_session_lock *lock, static void handle_surface_map(struct wl_listener *listener, void *data) { struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map); - if (surf->lock->focused == NULL) { + + struct sway_seat *seat = input_manager_current_seat(); + struct sway_workspace *focused_ws = seat_get_focused_workspace(seat); + struct sway_output *focused_output = NULL; + if (focused_ws != NULL) { + focused_output = focused_ws->output; + } + + if (surf->lock->focused == NULL || focused_output == surf->output) { focus_surface(surf->lock, surf->surface->surface); } cursor_rebase_all();