river: add send-to-previous-tags command

This commit is contained in:
Peter Rice
2021-09-11 16:21:48 -04:00
committed by Isaac Freund
parent 5f6428bafe
commit 81d103d425
6 changed files with 24 additions and 0 deletions

View File

@ -83,6 +83,7 @@ const str_to_impl_fn = [_]struct {
.{ .name = "toggle-fullscreen", .impl = @import("command/toggle_fullscreen.zig").toggleFullscreen },
.{ .name = "toggle-view-tags", .impl = @import("command/tags.zig").toggleViewTags },
.{ .name = "focus-previous-tags", .impl = @import("command/tags.zig").focusPreviousTags },
.{ .name = "send-to-previous-tags", .impl = @import("command/tags.zig").sendToPreviousTags },
.{ .name = "unmap", .impl = @import("command/map.zig").unmap },
.{ .name = "unmap-pointer", .impl = @import("command/map.zig").unmapPointer },
.{ .name = "xcursor-theme", .impl = @import("command/xcursor_theme.zig").xcursorTheme },

View File

@ -121,6 +121,22 @@ pub fn focusPreviousTags(
}
}
/// Set the tags of the focused view to the tags that were selected previously
pub fn sendToPreviousTags(
allocator: *std.mem.Allocator,
seat: *Seat,
args: []const []const u8,
out: *?[]const u8,
) Error!void {
const previous_tags = seat.focused_output.previous_tags;
if (seat.focused == .view) {
const view = seat.focused.view;
view.pending.tags = previous_tags;
seat.focus(null);
view.applyPending();
}
}
fn parseTags(
allocator: *std.mem.Allocator,
args: []const [:0]const u8,