Skip to content

Commit

Permalink
command/spawn-tagmask: apply globally
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ifreund committed Jan 1, 2023
1 parent 931405a commit 39104ae
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions doc/riverctl.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
3 changes: 3 additions & 0 deletions river/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
3 changes: 0 additions & 3 deletions river/Output.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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) = .{},

Expand Down
2 changes: 1 addition & 1 deletion river/View.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
5 changes: 2 additions & 3 deletions river/command/tags.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 39104ae

Please sign in to comment.