tony / oxwm

add xwayland run step to build.zig Browse files
emzywastaken committed 2026-02-15 parent 54f98ea commit 4bf28311153464fb0a48d922687a2a7b2ff2d4d6
Showing 1 changed file with 15 additions and 0 deletions. UnifiedSplit
+15 −0 build.zig
@@ -65,6 +65,9 @@ pub fn build(b: *std.Build) void {
65 const multimon_step = b.step("multimon", "Alias for xephyr-multi"); 65 const multimon_step = b.step("multimon", "Alias for xephyr-multi");
66 multimon_step.dependOn(&add_xephyr_run(b, exe, true).step); 66 multimon_step.dependOn(&add_xephyr_run(b, exe, true).step);
67 67
68 + const xwayland_step = b.step("xwayland", "Run in Xwayland on :2");
69 + xwayland_step.dependOn(&add_xwayland_run(b, exe).step);
70 +
68 const kill_step = b.step("kill", "Kill Xephyr and oxwm"); 71 const kill_step = b.step("kill", "Kill Xephyr and oxwm");
69 kill_step.dependOn(&b.addSystemCommand(&.{ "sh", "-c", "pkill -9 Xephyr || true; pkill -9 oxwm || true" }).step); 72 kill_step.dependOn(&b.addSystemCommand(&.{ "sh", "-c", "pkill -9 Xephyr || true; pkill -9 oxwm || true" }).step);
70 73
@@ -90,3 +93,15 @@ fn add_xephyr_run(b: *std.Build, exe: *std.Build.Step.Compile, multimon: bool) *
90 93
91 return run_wm; 94 return run_wm;
92 } 95 }
96 +
97 +fn add_xwayland_run(b: *std.Build, exe: *std.Build.Step.Compile) *std.Build.Step.Run {
98 + const cmd = "Xwayland -retro -noreset :2 & sleep 1";
99 +
100 + const setup = b.addSystemCommand(&.{ "sh", "-c", cmd });
101 +
102 + const run_wm = b.addRunArtifact(exe);
103 + run_wm.step.dependOn(&setup.step);
104 + run_wm.setEnvironmentVariable("DISPLAY", ":2");
105 +
106 + return run_wm;
107 +}