diff options
Diffstat (limited to 'src/command/zoom.zig')
| -rw-r--r-- | src/command/zoom.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/command/zoom.zig b/src/command/zoom.zig new file mode 100644 index 0000000..507620d --- /dev/null +++ b/src/command/zoom.zig @@ -0,0 +1,20 @@ +const c = @import("../c.zig"); + +const Arg = @import("../command.zig").Arg; +const Seat = @import("../seat.zig").Seat; +const View = @import("../view.zig").View; +const ViewStack = @import("../view_stack.zig").ViewStack; + +/// Bump the focused view to the top of the stack. +/// TODO: if the top of the stack is focused, bump the next visible view. +pub fn zoom(seat: *Seat, arg: Arg) void { + if (seat.focused_view) |current_focus| { + const output = seat.focused_output; + const node = @fieldParentPtr(ViewStack(View).Node, "view", current_focus); + if (node != output.views.first) { + output.views.remove(node); + output.views.push(node); + seat.input_manager.server.root.arrange(); + } + } +} |
