tony / oxwm

refactor: change `spawn_terminal` to take in the terminal name directly instead of wm instance Browse files
emzywastaken committed 2026-02-22 parent 43022c0 commit 9c02ffe2682ee72adaf57f2cd6a47209670924bd
Showing 1 changed file with 2 additions and 4 deletions. UnifiedSplit
+2 −4 src/main.zig
@@ -535,7 +535,7 @@ fn handle_key_press(event: *xlib.XKeyEvent, wm: *WindowManager) void {
535 535
536 fn execute_action(action: config_mod.Action, int_arg: i32, str_arg: ?[]const u8, wm: *WindowManager) void { 536 fn execute_action(action: config_mod.Action, int_arg: i32, str_arg: ?[]const u8, wm: *WindowManager) void {
537 switch (action) { 537 switch (action) {
538 - .spawn_terminal => spawn_terminal(wm), 538 + .spawn_terminal => spawn_terminal(wm.config.terminal),
539 .spawn => { 539 .spawn => {
540 if (str_arg) |cmd| spawn_command(cmd); 540 if (str_arg) |cmd| spawn_command(cmd);
541 }, 541 },
@@ -623,13 +623,11 @@ fn spawn_command(cmd: []const u8) void {
623 } 623 }
624 } 624 }
625 625
626 -// TODO: take in the terminal cmd directly. 626 +fn spawn_terminal(terminal: []const u8) void {
627 -fn spawn_terminal(wm: *WindowManager) void {
628 const pid = std.posix.fork() catch return; 627 const pid = std.posix.fork() catch return;
629 if (pid == 0) { 628 if (pid == 0) {
630 spawn_child_setup(); 629 spawn_child_setup();
631 var term_buf: [256]u8 = undefined; 630 var term_buf: [256]u8 = undefined;
632 - const terminal = wm.config.terminal;
633 if (terminal.len >= term_buf.len) { 631 if (terminal.len >= term_buf.len) {
634 std.posix.exit(1); 632 std.posix.exit(1);
635 } 633 }