command/spawn-tagmask: apply globally

Currently the spawn-tagmask applies to the currently focused output.
This however means that it is lost if the monitor is unplugged and makes
it hard to set for all outputs.

Change this to make the command apply to all outputs.

This is a breaking change.
This commit is contained in:
Isaac Freund 2023-01-02 00:54:53 +01:00
parent 931405abe4
commit 39104ae9e3
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
5 changed files with 10 additions and 12 deletions

View File

@ -137,11 +137,10 @@ are ignored by river.
set bits of _tags_. set bits of _tags_.
*spawn-tagmask* _tagmask_ *spawn-tagmask* _tagmask_
Set a _tagmask_ to filter the tags assigned to newly spawned views Set a _tagmask_ to filter the tags assigned to newly spawned views. This mask
on the focused output. This mask will be applied to the tags of will be applied to the tags of new views with a bitwise and. If, for example,
new views with a bitwise and. If, for example, the tags 000011111 the tags 000011111 are focused and the spawn _tagmask_ is 111110001, a
are focused on an output with a _tagmask_ of 111110001, a new view new view will be assigned the tags 000010001. If no tags would remain after
will be assigned the tags 000010001. If no tags would remain after
filtering, the _tagmask_ is ignored. filtering, the _tagmask_ is ignored.
*focus-previous-tags* *focus-previous-tags*

View File

@ -87,6 +87,9 @@ warp_cursor: WarpCursorMode = .disabled,
/// Output.layout_namespace is null. /// Output.layout_namespace is null.
default_layout_namespace: []const u8 = &[0]u8{}, default_layout_namespace: []const u8 = &[0]u8{},
/// Bitmask restricting the tags of newly created views.
spawn_tagmask: u32 = std.math.maxInt(u32),
/// Determines where new views will be attached to the view stack. /// Determines where new views will be attached to the view stack.
attach_mode: AttachMode = .top, attach_mode: AttachMode = .top,

View File

@ -96,9 +96,6 @@ layout_namespace: ?[]const u8 = null,
/// The last set layout name. /// The last set layout name.
layout_name: ?[:0]const u8 = null, layout_name: ?[:0]const u8 = null,
/// Bitmask that whitelists tags for newly spawned views
spawn_tagmask: u32 = math.maxInt(u32),
/// List of status tracking objects relaying changes to this output to clients. /// List of status tracking objects relaying changes to this output to clients.
status_trackers: std.SinglyLinkedList(OutputStatus) = .{}, status_trackers: std.SinglyLinkedList(OutputStatus) = .{},

View File

@ -127,7 +127,7 @@ request_activate: wl.Listener(*wlr.XdgActivationV1.event.RequestActivate) =
pub fn init(self: *Self, output: *Output, impl: Impl) void { pub fn init(self: *Self, output: *Output, impl: Impl) void {
const initial_tags = blk: { const initial_tags = blk: {
const tags = output.current.tags & output.spawn_tagmask; const tags = output.current.tags & server.config.spawn_tagmask;
break :blk if (tags != 0) tags else output.current.tags; break :blk if (tags != 0) tags else output.current.tags;
}; };

View File

@ -39,14 +39,13 @@ pub fn setFocusedTags(
} }
} }
/// Set the spawn tagmask
pub fn spawnTagmask( pub fn spawnTagmask(
seat: *Seat, _: *Seat,
args: []const [:0]const u8, args: []const [:0]const u8,
out: *?[]const u8, out: *?[]const u8,
) Error!void { ) Error!void {
const tags = try parseTags(args, out); const tags = try parseTags(args, out);
seat.focused_output.spawn_tagmask = tags; server.config.spawn_tagmask = tags;
} }
/// Set the tags of the focused view. /// Set the tags of the focused view.