tony / oxwm

implements : rule bypass for block's floating window Browse files
Using the click functionnality of the bar is nice but i have TUI like
bluetui or pulsemixer that were always opening in my "terminal" tag. a
bit annoying when i'm looking at my documentation on my browser tag.

Now there is an option to bypass the rules if needed.
Iziram committed 2026-03-12 parent 15d74dc commit bc5f7a55ee25b8bf0dc5837fe823e8379e0d8baf
Showing 5 changed files with 16 additions and 2 deletions. UnifiedSplit
+1 −0 src/config/config.zig
@@ -148,6 +148,7 @@ pub const FloatingPosition = enum {
148 pub const ClickAction = struct { 148 pub const ClickAction = struct {
149 command: []const u8, 149 command: []const u8,
150 floating: bool = false, 150 floating: bool = false,
151 + bypass_rules: bool = false,
151 }; 152 };
152 153
153 pub const Block = struct { 154 pub const Block = struct {
+5 −1 src/config/lua.zig
@@ -1252,7 +1252,11 @@ fn parseClickAction(state: *c.lua_State, idx: c_int) ?config_mod.ClickAction {
1252 const floating = c.lua_toboolean(state, -1) != 0; 1252 const floating = c.lua_toboolean(state, -1) != 0;
1253 c.lua_settop(state, -2); 1253 c.lua_settop(state, -2);
1254 1254
1255 - return .{ .command = cmd.?, .floating = floating }; 1255 + _ = c.lua_getfield(state, idx, "bypass_rules");
1256 + const bypass_rules = c.lua_toboolean(state, -1) != 0;
1257 + c.lua_settop(state, -2);
1258 +
1259 + return .{ .command = cmd.?, .floating = floating, .bypass_rules = bypass_rules };
1256 } 1260 }
1257 return null; 1261 return null;
1258 } 1262 }
+8 −1 src/wm/core.zig
@@ -40,7 +40,14 @@ pub fn manage(win: xlib.Window, window_attrs: *xlib.XWindowAttributes, wm: *Wind
40 40
41 if (client.monitor == null) { 41 if (client.monitor == null) {
42 client.monitor = wm.selected_monitor; 42 client.monitor = wm.selected_monitor;
43 - applyRules(client, wm); 43 + if (wm.next_spawn_bypass_rules) {
44 + if (client.monitor) |monitor| {
45 + client.tags = monitor.tagset[monitor.sel_tags];
46 + }
47 + wm.next_spawn_bypass_rules = false;
48 + } else {
49 + applyRules(client, wm);
50 + }
44 } 51 }
45 52
46 if (wm.next_spawn_floating) { 53 if (wm.next_spawn_floating) {
+1 −0 src/wm/handlers.zig
@@ -211,6 +211,7 @@ fn handleButtonPress(event: *xlib.XButtonEvent, wm: *WindowManager) void {
211 core.view(tag_mask, wm); 211 core.view(tag_mask, wm);
212 } else if (bar.handleBlockClick(event.x)) |click_action| { 212 } else if (bar.handleBlockClick(event.x)) |click_action| {
213 wm.next_spawn_floating = click_action.floating; 213 wm.next_spawn_floating = click_action.floating;
214 + wm.next_spawn_bypass_rules = click_action.bypass_rules;
214 actions.spawnCommand(wm, click_action.command); 215 actions.spawnCommand(wm, click_action.command);
215 } 216 }
216 return; 217 return;
+1 −0 src/wm/wm.zig
@@ -85,6 +85,7 @@ pub const WindowManager = struct {
85 85
86 running: bool, 86 running: bool,
87 next_spawn_floating: bool = false, 87 next_spawn_floating: bool = false,
88 + next_spawn_bypass_rules: bool = false,
88 last_motion_monitor: ?*Monitor, 89 last_motion_monitor: ?*Monitor,
89 90
90 /// Initialises the window manager 91 /// Initialises the window manager