command: Implement spawn-tagmask
This commit is contained in:
committed by
Isaac Freund
parent
75588a553c
commit
30ba87fa15
@ -73,6 +73,9 @@ layout: []const u8,
|
||||
/// Determines where new views will be attached to the view stack.
|
||||
attach_mode: AttachMode = .top,
|
||||
|
||||
/// Bitmask that whitelists tags for newly spawned views
|
||||
spawn_tagmask: u32 = std.math.maxInt(u32),
|
||||
|
||||
/// List of status tracking objects relaying changes to this output to clients.
|
||||
status_trackers: std.SinglyLinkedList(OutputStatus) = .{},
|
||||
|
||||
|
@ -177,7 +177,7 @@ fn handleNewXdgSurface(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wl
|
||||
xdg_surface.resource.postNoMemory();
|
||||
return;
|
||||
};
|
||||
node.view.init(output, output.current.tags, xdg_surface);
|
||||
node.view.init(output, getNewViewTags(output), xdg_surface);
|
||||
}
|
||||
|
||||
/// This event is raised when the layer_shell recieves a new surface from a client.
|
||||
@ -247,5 +247,10 @@ fn handleNewXwaylandSurface(listener: *wl.Listener(*wlr.XwaylandSurface), wlr_xw
|
||||
// The View will add itself to the output's view stack on map
|
||||
const output = self.input_manager.defaultSeat().focused_output;
|
||||
const node = util.gpa.create(ViewStack(View).Node) catch return;
|
||||
node.view.init(output, output.current.tags, wlr_xwayland_surface);
|
||||
node.view.init(output, getNewViewTags(output), wlr_xwayland_surface);
|
||||
}
|
||||
|
||||
fn getNewViewTags(output: *Output) u32 {
|
||||
const tags = output.current.tags & output.spawn_tagmask;
|
||||
return if (tags != 0) tags else output.current.tags;
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ const str_to_impl_fn = [_]struct {
|
||||
.{ .name = "set-view-tags", .impl = @import("command/tags.zig").setViewTags },
|
||||
.{ .name = "snap", .impl = @import("command/move.zig").snap },
|
||||
.{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },
|
||||
.{ .name = "spawn-tagmask", .impl = @import("command/tags.zig").spawnTagmask },
|
||||
.{ .name = "swap", .impl = @import("command/swap.zig").swap},
|
||||
.{ .name = "toggle-float", .impl = @import("command/toggle_float.zig").toggleFloat },
|
||||
.{ .name = "toggle-focused-tags", .impl = @import("command/tags.zig").toggleFocusedTags },
|
||||
|
@ -36,6 +36,17 @@ pub fn setFocusedTags(
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the spawn tagmask
|
||||
pub fn spawnTagmask(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const []const u8,
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
const tags = try parseTags(allocator, args, out);
|
||||
seat.focused_output.spawn_tagmask = tags;
|
||||
}
|
||||
|
||||
/// Set the tags of the focused view.
|
||||
pub fn setViewTags(
|
||||
allocator: *std.mem.Allocator,
|
||||
|
Reference in New Issue
Block a user