river: add send-to-previous-tags command
This commit is contained in:
		@ -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 },
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user