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.
This commit is contained in:
Ben Buhse 2026-03-02 15:16:10 -06:00
commit ece7b7e5bd
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4

View file

@ -335,7 +335,12 @@ const XkbBinding = struct {
.prev => wm.outputs.last(), .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 }; seat.pending_manage.output = .{ .output = output };
// We got the new output, but we need to switch window focus, too // We got the new output, but we need to switch window focus, too
@ -373,9 +378,12 @@ const XkbBinding = struct {
.prev => wm.outputs.last(), .prev => wm.outputs.last(),
}; };
if (pending_output) |output| { if (pending_output) |output| blk: {
// This should be a noop if there's only one output // This should be a noop if there's only one output
if (output != window.output) { if (output == window.output) {
break :blk;
}
// We have to remove window from current output's windows list first // We have to remove window from current output's windows list first
window.link.remove(); window.link.remove();
output.windows.append(window); output.windows.append(window);
@ -385,7 +393,6 @@ const XkbBinding = struct {
window.pending_manage.pending_output = .{ .output = output }; window.pending_manage.pending_output = .{ .output = output };
} }
} }
}
fn moveFloatingWindow(context: *Context, dx: i32, dy: i32) void { fn moveFloatingWindow(context: *Context, dx: i32, dy: i32) void {
const seat = context.wm.seats.first() orelse return; const seat = context.wm.seats.first() orelse return;