From 39104ae9e3db55e5c3e8428bfdad67153b58737d Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Mon, 2 Jan 2023 00:54:53 +0100 Subject: [PATCH] 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. --- doc/riverctl.1.scd | 9 ++++----- river/Config.zig | 3 +++ river/Output.zig | 3 --- river/View.zig | 2 +- river/command/tags.zig | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/doc/riverctl.1.scd b/doc/riverctl.1.scd index 3009a16..7fc08dc 100644 --- a/doc/riverctl.1.scd +++ b/doc/riverctl.1.scd @@ -137,11 +137,10 @@ are ignored by river. set bits of _tags_. *spawn-tagmask* _tagmask_ - Set a _tagmask_ to filter the tags assigned to newly spawned views - on the focused output. This mask will be applied to the tags of - new views with a bitwise and. If, for example, the tags 000011111 - are focused on an output with a _tagmask_ of 111110001, a new view - will be assigned the tags 000010001. If no tags would remain after + Set a _tagmask_ to filter the tags assigned to newly spawned views. This mask + will be applied to the tags of new views with a bitwise and. If, for example, + the tags 000011111 are focused and the spawn _tagmask_ is 111110001, a + new view will be assigned the tags 000010001. If no tags would remain after filtering, the _tagmask_ is ignored. *focus-previous-tags* diff --git a/river/Config.zig b/river/Config.zig index 5b5e387..bf152ca 100644 --- a/river/Config.zig +++ b/river/Config.zig @@ -87,6 +87,9 @@ warp_cursor: WarpCursorMode = .disabled, /// Output.layout_namespace is null. 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. attach_mode: AttachMode = .top, diff --git a/river/Output.zig b/river/Output.zig index be9f575..d1469d9 100644 --- a/river/Output.zig +++ b/river/Output.zig @@ -96,9 +96,6 @@ layout_namespace: ?[]const u8 = null, /// The last set layout name. 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. status_trackers: std.SinglyLinkedList(OutputStatus) = .{}, diff --git a/river/View.zig b/river/View.zig index 40e4db4..46db9cd 100644 --- a/river/View.zig +++ b/river/View.zig @@ -127,7 +127,7 @@ request_activate: wl.Listener(*wlr.XdgActivationV1.event.RequestActivate) = pub fn init(self: *Self, output: *Output, impl: Impl) void { 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; }; diff --git a/river/command/tags.zig b/river/command/tags.zig index c8b4338..460a736 100644 --- a/river/command/tags.zig +++ b/river/command/tags.zig @@ -39,14 +39,13 @@ pub fn setFocusedTags( } } -/// Set the spawn tagmask pub fn spawnTagmask( - seat: *Seat, + _: *Seat, args: []const [:0]const u8, out: *?[]const u8, ) Error!void { const tags = try parseTags(args, out); - seat.focused_output.spawn_tagmask = tags; + server.config.spawn_tagmask = tags; } /// Set the tags of the focused view.