config: make attach-mode global

This commit is contained in:
novakane 2021-06-08 09:50:42 +02:00 committed by Isaac Freund
parent 75814eb876
commit 2e7c1dbe6a
7 changed files with 13 additions and 12 deletions

View file

@ -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 -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' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a unmap-pointer -d 'Remove the pointer mapping defined by the arguments'
# Configuration # 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 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-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' complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a border-color-unfocused -d 'Set the border color of unfocused views'

View file

@ -47,7 +47,7 @@ _riverctl() {
'unmap:Remove the mapping defined by the arguments' 'unmap:Remove the mapping defined by the arguments'
'unmap-pointer:Remove the pointer mapping defined by the arguments' 'unmap-pointer:Remove the pointer mapping defined by the arguments'
# Configuration # 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' 'background-color:Set the background color'
'border-color-focused:Set the border color of focused views' 'border-color-focused:Set the border color of focused views'
'border-color-unfocused:Set the border color of unfocused views' 'border-color-unfocused:Set the border color of unfocused views'

View file

@ -209,8 +209,7 @@ A complete list may be found in _/usr/include/linux/input-event-codes.h_
## CONFIGURATION ## CONFIGURATION
*attach-mode* *top*|*bottom* *attach-mode* *top*|*bottom*
Configure where new views should attach to the view stack for the Configure where new views should attach to the view stack.
currently focused output.
*background-color* _#RRGGBB_|_#RRGGBBAA_ *background-color* _#RRGGBB_|_#RRGGBBAA_
Set the background color. Set the background color.

View file

@ -23,6 +23,7 @@ const util = @import("util.zig");
const Server = @import("Server.zig"); const Server = @import("Server.zig");
const Mode = @import("Mode.zig"); const Mode = @import("Mode.zig");
const AttachMode = @import("view_stack.zig").AttachMode;
pub const FocusFollowsCursorMode = enum { pub const FocusFollowsCursorMode = enum {
disabled, disabled,
@ -64,6 +65,9 @@ focus_follows_cursor: FocusFollowsCursorMode = .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{},
/// Determines where new views will be attached to the view stack.
attach_mode: AttachMode = .top,
opacity: struct { opacity: struct {
/// The opacity of focused views /// The opacity of focused views
focused: f32 = 1.0, focused: f32 = 1.0,

View file

@ -35,7 +35,6 @@ const Layout = @import("Layout.zig");
const LayoutDemand = @import("LayoutDemand.zig"); const LayoutDemand = @import("LayoutDemand.zig");
const View = @import("View.zig"); const View = @import("View.zig");
const ViewStack = @import("view_stack.zig").ViewStack; const ViewStack = @import("view_stack.zig").ViewStack;
const AttachMode = @import("view_stack.zig").AttachMode;
const OutputStatus = @import("OutputStatus.zig"); const OutputStatus = @import("OutputStatus.zig");
const State = struct { const State = struct {
@ -83,9 +82,6 @@ layouts: std.TailQueue(Layout) = .{},
/// Call handleLayoutNamespaceChange() after setting this. /// Call handleLayoutNamespaceChange() after setting this.
layout_namespace: ?[]const u8 = null, 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 /// Bitmask that whitelists tags for newly spawned views
spawn_tagmask: u32 = std.math.maxInt(u32), spawn_tagmask: u32 = std.math.maxInt(u32),

View file

@ -296,7 +296,7 @@ pub fn sendToOutput(self: *Self, destination_output: *Output) void {
const node = @fieldParentPtr(ViewStack(Self).Node, "view", self); const node = @fieldParentPtr(ViewStack(Self).Node, "view", self);
self.output.views.remove(node); 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(); self.output.sendViewTags();
destination_output.sendViewTags(); destination_output.sendViewTags();
@ -466,7 +466,7 @@ pub fn map(self: *Self) void {
// Add the view to the stack of its output // Add the view to the stack of its output
const node = @fieldParentPtr(ViewStack(Self).Node, "view", self); 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 // Focus the new view, assuming the seat is focusing the proper output
// and there isn't something else like a fullscreen view grabbing focus. // and there isn't something else like a fullscreen view grabbing focus.

View file

@ -19,6 +19,8 @@ const std = @import("std");
const util = @import("../util.zig"); const util = @import("../util.zig");
const server = &@import("../main.zig").server;
const Error = @import("../command.zig").Error; const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig"); const Seat = @import("../Seat.zig");
@ -32,9 +34,9 @@ pub fn attachMode(
if (args.len > 2) return Error.TooManyArguments; if (args.len > 2) return Error.TooManyArguments;
if (std.mem.eql(u8, "top", args[1])) { 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])) { } else if (std.mem.eql(u8, "bottom", args[1])) {
seat.focused_output.attach_mode = .bottom; server.config.attach_mode = .bottom;
} else { } else {
return Error.UnknownOption; return Error.UnknownOption;
} }