Make Config a topleve struct

This commit is contained in:
Isaac Freund 2020-05-02 16:27:00 +02:00
parent d20d01e596
commit a03cab94fc
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 170 additions and 171 deletions

View file

@ -1,35 +1,35 @@
const Self = @This();
const std = @import("std"); const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig");
const command = @import("command.zig"); const command = @import("command.zig");
const Server = @import("server.zig"); const Server = @import("server.zig");
pub const Config = struct { /// Width of borders in pixels
const Self = @This(); border_width: u32,
/// Width of borders in pixels /// Amount of view padding in pixels
border_width: u32, view_padding: u32,
/// Amount of view padding in pixels /// Amount of padding arount the outer edge of the layout in pixels
view_padding: u32, outer_padding: u32,
/// Amount of padding arount the outer edge of the layout in pixels const Keybind = struct {
outer_padding: u32,
const Keybind = struct {
keysym: c.xkb_keysym_t, keysym: c.xkb_keysym_t,
modifiers: u32, modifiers: u32,
command: command.Command, command: command.Command,
arg: command.Arg, arg: command.Arg,
}; };
/// All user-defined keybindings /// All user-defined keybindings
keybinds: std.ArrayList(Keybind), keybinds: std.ArrayList(Keybind),
/// List of app_ids which will be started floating /// List of app_ids which will be started floating
float_filter: std.ArrayList([*:0]const u8), float_filter: std.ArrayList([*:0]const u8),
pub fn init(self: *Self, allocator: *std.mem.Allocator) !void { pub fn init(self: *Self, allocator: *std.mem.Allocator) !void {
self.border_width = 2; self.border_width = 2;
self.view_padding = 8; self.view_padding = 8;
self.outer_padding = 8; self.outer_padding = 8;
@ -203,5 +203,4 @@ pub const Config = struct {
}); });
try self.float_filter.append("float"); try self.float_filter.append("float");
} }
};

View file

@ -4,7 +4,7 @@ const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig");
const Config = @import("config.zig").Config; const Config = @import("config.zig");
const DecorationManager = @import("decoration_manager.zig"); const DecorationManager = @import("decoration_manager.zig");
const InputManager = @import("input_manager.zig").InputManager; const InputManager = @import("input_manager.zig").InputManager;
const Log = @import("log.zig").Log; const Log = @import("log.zig").Log;