command: Implement spawn-tagmask
This commit is contained in:
parent
75588a553c
commit
30ba87fa15
@ -104,6 +104,8 @@ take a normal base 10 number as their argument but the semantics are best
|
|||||||
understood in binary. The binary number 000000001 represents a set containing
|
understood in binary. The binary number 000000001 represents a set containing
|
||||||
only tag 1 while 100001101 represents a set containing tags 1, 3, 4, and 9.
|
only tag 1 while 100001101 represents a set containing tags 1, 3, 4, and 9.
|
||||||
|
|
||||||
|
When a view spawns it is assigned the currently focused tags of the output.
|
||||||
|
|
||||||
At least one tag must always be focused and each view must be assigned at
|
At least one tag must always be focused and each view must be assigned at
|
||||||
least one tag. Operations that would violate either of these requirements
|
least one tag. Operations that would violate either of these requirements
|
||||||
are ignored by river.
|
are ignored by river.
|
||||||
@ -124,6 +126,14 @@ are ignored by river.
|
|||||||
Toggle the tags of the currently focused view corresponding to the
|
Toggle the tags of the currently focused view corresponding to the
|
||||||
set bits of _tags_.
|
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
|
||||||
|
filtering, the _tagmask_ is ignored.
|
||||||
|
|
||||||
## MAPPINGS
|
## MAPPINGS
|
||||||
|
|
||||||
Mappings are modal in river. Each mapping is associated with a mode and is
|
Mappings are modal in river. Each mapping is associated with a mode and is
|
||||||
|
@ -73,6 +73,9 @@ layout: []const u8,
|
|||||||
/// 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,
|
||||||
|
|
||||||
|
/// 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.
|
/// List of status tracking objects relaying changes to this output to clients.
|
||||||
status_trackers: std.SinglyLinkedList(OutputStatus) = .{},
|
status_trackers: std.SinglyLinkedList(OutputStatus) = .{},
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ fn handleNewXdgSurface(listener: *wl.Listener(*wlr.XdgSurface), xdg_surface: *wl
|
|||||||
xdg_surface.resource.postNoMemory();
|
xdg_surface.resource.postNoMemory();
|
||||||
return;
|
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.
|
/// 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
|
// The View will add itself to the output's view stack on map
|
||||||
const output = self.input_manager.defaultSeat().focused_output;
|
const output = self.input_manager.defaultSeat().focused_output;
|
||||||
const node = util.gpa.create(ViewStack(View).Node) catch return;
|
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 = "set-view-tags", .impl = @import("command/tags.zig").setViewTags },
|
||||||
.{ .name = "snap", .impl = @import("command/move.zig").snap },
|
.{ .name = "snap", .impl = @import("command/move.zig").snap },
|
||||||
.{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },
|
.{ .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 = "swap", .impl = @import("command/swap.zig").swap},
|
||||||
.{ .name = "toggle-float", .impl = @import("command/toggle_float.zig").toggleFloat },
|
.{ .name = "toggle-float", .impl = @import("command/toggle_float.zig").toggleFloat },
|
||||||
.{ .name = "toggle-focused-tags", .impl = @import("command/tags.zig").toggleFocusedTags },
|
.{ .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.
|
/// Set the tags of the focused view.
|
||||||
pub fn setViewTags(
|
pub fn setViewTags(
|
||||||
allocator: *std.mem.Allocator,
|
allocator: *std.mem.Allocator,
|
||||||
|
Loading…
Reference in New Issue
Block a user