diff --git a/completions/fish/riverctl.fish b/completions/fish/riverctl.fish index c3139dc..9f4392f 100644 --- a/completions/fish/riverctl.fish +++ b/completions/fish/riverctl.fish @@ -41,7 +41,7 @@ complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a map-point complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a unmap -d 'Remove the mapping defined by the arguments' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a unmap-pointer -d 'Remove the pointer mapping defined by the arguments' # Configuration -complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a attach-mode -d 'Configure where new views should attach to the view stack for the currently focused output' +complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a attach-mode -d 'Configure where new views should attach to the view stack' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a background-color -d 'Set the background color' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a border-color-focused -d 'Set the border color of focused views' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a border-color-unfocused -d 'Set the border color of unfocused views' diff --git a/completions/zsh/_riverctl b/completions/zsh/_riverctl index 1e0f60c..428915b 100644 --- a/completions/zsh/_riverctl +++ b/completions/zsh/_riverctl @@ -47,7 +47,7 @@ _riverctl() { 'unmap:Remove the mapping defined by the arguments' 'unmap-pointer:Remove the pointer mapping defined by the arguments' # Configuration - 'attach-mode:Configure where new views should attach to the view stack for the currently focused output' + 'attach-mode:Configure where new views should attach to the view stack' 'background-color:Set the background color' 'border-color-focused:Set the border color of focused views' 'border-color-unfocused:Set the border color of unfocused views' diff --git a/doc/riverctl.1.scd b/doc/riverctl.1.scd index 96589d5..c02a8f3 100644 --- a/doc/riverctl.1.scd +++ b/doc/riverctl.1.scd @@ -209,8 +209,7 @@ A complete list may be found in _/usr/include/linux/input-event-codes.h_ ## CONFIGURATION *attach-mode* *top*|*bottom* - Configure where new views should attach to the view stack for the - currently focused output. + Configure where new views should attach to the view stack. *background-color* _#RRGGBB_|_#RRGGBBAA_ Set the background color. diff --git a/river/Config.zig b/river/Config.zig index 9a4c75f..91e62e5 100644 --- a/river/Config.zig +++ b/river/Config.zig @@ -23,6 +23,7 @@ const util = @import("util.zig"); const Server = @import("Server.zig"); const Mode = @import("Mode.zig"); +const AttachMode = @import("view_stack.zig").AttachMode; pub const FocusFollowsCursorMode = enum { disabled, @@ -64,6 +65,9 @@ focus_follows_cursor: FocusFollowsCursorMode = .disabled, /// Output.layout_namespace is null. default_layout_namespace: []const u8 = &[0]u8{}, +/// Determines where new views will be attached to the view stack. +attach_mode: AttachMode = .top, + opacity: struct { /// The opacity of focused views focused: f32 = 1.0, diff --git a/river/Output.zig b/river/Output.zig index 4bd1bb2..38fc13e 100644 --- a/river/Output.zig +++ b/river/Output.zig @@ -35,7 +35,6 @@ const Layout = @import("Layout.zig"); const LayoutDemand = @import("LayoutDemand.zig"); const View = @import("View.zig"); const ViewStack = @import("view_stack.zig").ViewStack; -const AttachMode = @import("view_stack.zig").AttachMode; const OutputStatus = @import("OutputStatus.zig"); const State = struct { @@ -83,9 +82,6 @@ layouts: std.TailQueue(Layout) = .{}, /// Call handleLayoutNamespaceChange() after setting this. layout_namespace: ?[]const u8 = null, -/// 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), diff --git a/river/View.zig b/river/View.zig index a8b9c63..816c72e 100644 --- a/river/View.zig +++ b/river/View.zig @@ -296,7 +296,7 @@ pub fn sendToOutput(self: *Self, destination_output: *Output) void { const node = @fieldParentPtr(ViewStack(Self).Node, "view", self); self.output.views.remove(node); - destination_output.views.attach(node, destination_output.attach_mode); + destination_output.views.attach(node, server.config.attach_mode); self.output.sendViewTags(); destination_output.sendViewTags(); @@ -466,7 +466,7 @@ pub fn map(self: *Self) void { // Add the view to the stack of its output const node = @fieldParentPtr(ViewStack(Self).Node, "view", self); - self.output.views.attach(node, self.output.attach_mode); + self.output.views.attach(node, server.config.attach_mode); // Focus the new view, assuming the seat is focusing the proper output // and there isn't something else like a fullscreen view grabbing focus. diff --git a/river/command/attach_mode.zig b/river/command/attach_mode.zig index 6dd1dd5..f9505b4 100644 --- a/river/command/attach_mode.zig +++ b/river/command/attach_mode.zig @@ -19,6 +19,8 @@ const std = @import("std"); const util = @import("../util.zig"); +const server = &@import("../main.zig").server; + const Error = @import("../command.zig").Error; const Seat = @import("../Seat.zig"); @@ -32,9 +34,9 @@ pub fn attachMode( if (args.len > 2) return Error.TooManyArguments; if (std.mem.eql(u8, "top", args[1])) { - seat.focused_output.attach_mode = .top; + server.config.attach_mode = .top; } else if (std.mem.eql(u8, "bottom", args[1])) { - seat.focused_output.attach_mode = .bottom; + server.config.attach_mode = .bottom; } else { return Error.UnknownOption; }