Diff
diff --git a/src/bar/bar.zig b/src/bar/bar.zig
index 6b0e86d..7eddf63 100644
--- a/src/bar/bar.zig
+++ b/src/bar/bar.zig
@@ -16,6 +16,7 @@ fn get_layout_symbol(layout_index: u32) []const u8 {
1 => conf.layout_monocle_symbol,
2 => conf.layout_floating_symbol,
3 => "[S]",
+ 4 => "[#]",
else => "[?]",
};
}
@@ -24,6 +25,7 @@ fn get_layout_symbol(layout_index: u32) []const u8 {
1 => "[M]",
2 => "><>",
3 => "[S]",
+ 4 => "[#]",
else => "[?]",
};
}
diff --git a/src/main.zig b/src/main.zig
index f11dfaa..cd57144 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -9,6 +9,7 @@ const tiling = @import("layouts/tiling.zig");
const monocle = @import("layouts/monocle.zig");
const floating = @import("layouts/floating.zig");
const scrolling = @import("layouts/scrolling.zig");
+const grid = @import("layouts/grid.zig");
const animations = @import("animations.zig");
const bar_mod = @import("bar/bar.zig");
const blocks_mod = @import("bar/blocks/blocks.zig");
@@ -349,11 +350,13 @@ fn setup_monitors(display: *Display) void {
mon.lt[1] = &monocle.layout;
mon.lt[2] = &floating.layout;
mon.lt[3] = &scrolling.layout;
+ mon.lt[4] = &grid.layout;
for (0..10) |i| {
mon.pertag.ltidxs[i][0] = mon.lt[0];
mon.pertag.ltidxs[i][1] = mon.lt[1];
mon.pertag.ltidxs[i][2] = mon.lt[2];
mon.pertag.ltidxs[i][3] = mon.lt[3];
+ mon.pertag.ltidxs[i][4] = mon.lt[4];
}
if (prev_monitor) |prev| {
@@ -387,11 +390,13 @@ fn setup_monitors(display: *Display) void {
mon.lt[1] = &monocle.layout;
mon.lt[2] = &floating.layout;
mon.lt[3] = &scrolling.layout;
+ mon.lt[4] = &grid.layout;
for (0..10) |i| {
mon.pertag.ltidxs[i][0] = mon.lt[0];
mon.pertag.ltidxs[i][1] = mon.lt[1];
mon.pertag.ltidxs[i][2] = mon.lt[2];
mon.pertag.ltidxs[i][3] = mon.lt[3];
+ mon.pertag.ltidxs[i][4] = mon.lt[4];
}
monitor_mod.monitors = mon;
monitor_mod.selected_monitor = mon;
@@ -1466,7 +1471,7 @@ fn setmfact(delta: f32) void {
fn cycle_layout() void {
const monitor = monitor_mod.selected_monitor orelse return;
- const new_lt = (monitor.sel_lt + 1) % 4;
+ const new_lt = (monitor.sel_lt + 1) % 5;
monitor.sel_lt = new_lt;
monitor.pertag.sellts[monitor.pertag.curtag] = new_lt;
if (new_lt != 3) {
@@ -1491,6 +1496,8 @@ fn set_layout(layout_name: ?[]const u8) void {
2
else if (std.mem.eql(u8, name, "scrolling") or std.mem.eql(u8, name, "[S]"))
3
+ else if (std.mem.eql(u8, name, "grid") or std.mem.eql(u8, name, "[#]"))
+ 4
else {
std.debug.print("set_layout: unknown layout '{s}'\n", .{name});
return;
diff --git a/src/monitor.zig b/src/monitor.zig
index 495ee91..173e1e7 100644
--- a/src/monitor.zig
+++ b/src/monitor.zig
@@ -13,7 +13,7 @@ pub const Pertag = struct {
nmasters: [10]i32 = [_]i32{1} ** 10,
mfacts: [10]f32 = [_]f32{0.55} ** 10,
sellts: [10]u32 = [_]u32{0} ** 10,
- ltidxs: [10][4]?*const Layout = [_][4]?*const Layout{.{ null, null, null, null }} ** 10,
+ ltidxs: [10][5]?*const Layout = [_][5]?*const Layout{.{ null, null, null, null, null }} ** 10,
showbars: [10]bool = [_]bool{true} ** 10,
};
@@ -46,7 +46,7 @@ pub const Monitor = struct {
stack: ?*Client = null,
next: ?*Monitor = null,
bar_win: xlib.Window = 0,
- lt: [4]?*const Layout = .{ null, null, null, null },
+ lt: [5]?*const Layout = .{ null, null, null, null, null },
pertag: Pertag = Pertag{},
};