config: make attach-mode global
This commit is contained in:
@ -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,
|
||||
|
@ -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),
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user