From ece7b7e5bdfceefd9f3f1ea73e18a10bae5b1b81 Mon Sep 17 00:00:00 2001 From: Ben Buhse Date: Mon, 2 Mar 2026 15:16:10 -0600 Subject: [PATCH] Fix focus_next/prev_output command I fixed trying to send windows to a new output before, but now this fixes it for also switching output focus. --- src/XkbBindings.zig | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/XkbBindings.zig b/src/XkbBindings.zig index 1141549..8b9819b 100644 --- a/src/XkbBindings.zig +++ b/src/XkbBindings.zig @@ -335,7 +335,12 @@ const XkbBinding = struct { .prev => wm.outputs.last(), }; - if (pending_focus) |output| { + if (pending_focus) |output| blk: { + // This should be a noop if there's only one output + if (output == seat.focused_output) { + break :blk; + } + seat.pending_manage.output = .{ .output = output }; // We got the new output, but we need to switch window focus, too @@ -373,17 +378,19 @@ const XkbBinding = struct { .prev => wm.outputs.last(), }; - if (pending_output) |output| { + if (pending_output) |output| blk: { // This should be a noop if there's only one output - if (output != window.output) { - // We have to remove window from current output's windows list first - window.link.remove(); - output.windows.append(window); - - seat.pending_manage.output = .{ .output = output }; - seat.pending_manage.should_warp_pointer = true; - window.pending_manage.pending_output = .{ .output = output }; + if (output == window.output) { + break :blk; } + + // We have to remove window from current output's windows list first + window.link.remove(); + output.windows.append(window); + + seat.pending_manage.output = .{ .output = output }; + seat.pending_manage.should_warp_pointer = true; + window.pending_manage.pending_output = .{ .output = output }; } }