tony / oxwm

fix: actually run autostart commands Browse files
fixes #145
emzywastaken committed 2026-02-16 parent 3f07d04 commit 7344825cc445a9fda993719d9d631a9f164d5122
Showing 1 changed file with 6 additions and 0 deletions. UnifiedSplit
+6 −0 src/main.zig
@@ -213,6 +213,7 @@ pub fn main() !void {
213 grab_keybinds(&display); 213 grab_keybinds(&display);
214 scan_existing_windows(&display); 214 scan_existing_windows(&display);
215 215
216 + try run_autostart_commands(allocator, config.autostart.items);
216 std.debug.print("entering event loop\n", .{}); 217 std.debug.print("entering event loop\n", .{});
217 run_event_loop(&display); 218 run_event_loop(&display);
218 219
@@ -1039,6 +1040,7 @@ fn spawn_child_setup() void {
1039 } 1040 }
1040 1041
1041 fn spawn_command(cmd: []const u8) void { 1042 fn spawn_command(cmd: []const u8) void {
1043 + std.debug.print("running cmd: {s}\n", .{cmd});
1042 const pid = std.posix.fork() catch return; 1044 const pid = std.posix.fork() catch return;
1043 if (pid == 0) { 1045 if (pid == 0) {
1044 spawn_child_setup(); 1046 spawn_child_setup();
@@ -2490,6 +2492,10 @@ fn set_urgent(display: *Display, client: *Client, urgent: bool) void {
2490 } 2492 }
2491 } 2493 }
2492 2494
2495 +fn run_autostart_commands(_: std.mem.Allocator, commands: []const []const u8) !void {
2496 + for (commands) |cmd| spawn_command(cmd);
2497 +}
2498 +
2493 test { 2499 test {
2494 _ = @import("x11/events.zig"); 2500 _ = @import("x11/events.zig");
2495 } 2501 }