tony / oxwm

Attach Methods now saved in WM struct Browse files
MaliCopter committed 2026-09-09 parent c95e5bb commit 3bd400f8215add1bf8f2c8ce247e2e913f705339
Showing 5 changed files with 8 additions and 9 deletions. UnifiedSplit
+1 −1 resources/test-config.lua
@@ -40,7 +40,7 @@ oxwm.bar.set_hide_vacant_tags(false);
40 40 oxwm.set_layout_symbol("tiling", "[T]")
41 41 oxwm.set_layout_symbol("normie", "[F]")
42 42
43 -oxwm.set_attach_method("below")
43 +oxwm.set_attach_method("above")
44 44
45 45 oxwm.border.set_width(2)
46 46 oxwm.border.set_focused_color(colors.blue)
+0 −1 src/monitor.zig
@@ -41,7 +41,6 @@ pub const Monitor = struct {
41 41 scroll_offset: i32 = 0,
42 42 sel_tags: u32 = 0,
43 43 sel_lt: u32 = 0,
44 - att_m: u32 = 0,
45 44 tagset: [2]u32 = .{ 1, 1 },
46 45 show_bar: bool = true,
47 46 top_bar: bool = true,
+1 −2 src/wm/actions.zig
@@ -441,7 +441,6 @@ pub fn setLayoutIndex(index: u32, wm: *WindowManager) void {
441 441 }
442 442
443 443 pub fn setAttachMethod(attach_method_name: ?[]const u8, wm: *WindowManager) void {
444 - const monitor = wm.selected_monitor orelse return;
445 444 const name = attach_method_name orelse return;
446 445 const new_att_m: u32 = if (config_mod.AttachMethods.fromString(name)) |value|
447 446 @intFromEnum(value)
@@ -449,7 +448,7 @@ pub fn setAttachMethod(attach_method_name: ?[]const u8, wm: *WindowManager) void
449 448 std.debug.print("set_attach_method: unknown attach method '{s}'\n", .{name});
450 449 return;
451 450 };
452 - monitor.att_m = new_att_m;
451 + wm.attach_method = new_att_m;
453 452 }
454 453
455 454 fn warpCursorToMonitor(monitor: *Monitor, wm: *WindowManager) void {
+1 −1 src/wm/core.zig
@@ -90,7 +90,7 @@ pub fn manage(win: xlib.Window, window_attrs: *xlib.XWindowAttributes, wm: *Wind
90 90 _ = xlib.XRaiseWindow(wm.display.handle, client.window);
91 91 }
92 92
93 - attach(client, monitor.att_m);
93 + attach(client, wm.attach_method);
94 94 client_mod.attachStack(client);
95 95
96 96 _ = xlib.XChangeProperty(wm.display.handle, wm.display.root, wm.atoms.net_client_list, xlib.XA_WINDOW, 32, xlib.PropModeAppend, @ptrCast(&client.window), 1);
+5 −4 src/wm/wm.zig
@@ -77,6 +77,8 @@ pub const WindowManager = struct {
77 77 /// The monitor that currently has input focus.
78 78 selected_monitor: ?*Monitor,
79 79
80 + attach_method: u32,
81 +
80 82 /// Head of the linked list of status bars (one per monitor).
81 83 bars: ?*Bar,
82 84
@@ -125,6 +127,7 @@ pub const WindowManager = struct {
125 127 .config_path = config_path,
126 128 .monitors = null,
127 129 .selected_monitor = null,
130 + .attach_method = @intFromEnum(config_mod.AttachMethods.fromString(config.attach_method) orelse config_mod.AttachMethods.aside),
128 131 .bars = null,
129 132 .chord = .{},
130 133 .overlay = null,
@@ -194,10 +197,6 @@ pub const WindowManager = struct {
194 197 mon.sel_lt = @intFromEnum(value);
195 198 }
196 199
197 - if (config_mod.AttachMethods.fromString(self.config.attach_method)) |value| {
198 - mon.att_m = @intFromEnum(value);
199 - }
200 -
201 200 for (0..10) |i| {
202 201 for (0..layouts.len) |j| {
203 202 mon.pertag.ltidxs[i][j] = mon.lt[j];
@@ -722,6 +721,8 @@ pub const WindowManager = struct {
722 721
723 722 loadFn(self);
724 723
724 + self.attach_method = @intFromEnum(config_mod.AttachMethods.fromString(self.config.attach_method) orelse config_mod.AttachMethods.aside);
725 +
725 726 bar_mod.destroyBars(self.bars, self.display.handle);
726 727 self.bars = null;
727 728 self.setupBars();