oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

add xwayland run step to build.zig

Commit
4bf28311153464fb0a48d922687a2a7b2ff2d4d6
Parent
54f98ea
Author
emzywastaken <amiamemetoo@gmail.com>
Date
2026-02-15 17:03:56

Diff

diff --git a/build.zig b/build.zig
index c6596ae..230d26a 100644
--- a/build.zig
+++ b/build.zig
@@ -65,6 +65,9 @@ pub fn build(b: *std.Build) void {
     const multimon_step = b.step("multimon", "Alias for xephyr-multi");
     multimon_step.dependOn(&add_xephyr_run(b, exe, true).step);
 
+    const xwayland_step = b.step("xwayland", "Run in Xwayland on :2");
+    xwayland_step.dependOn(&add_xwayland_run(b, exe).step);
+
     const kill_step = b.step("kill", "Kill Xephyr and oxwm");
     kill_step.dependOn(&b.addSystemCommand(&.{ "sh", "-c", "pkill -9 Xephyr || true; pkill -9 oxwm || true" }).step);
 
@@ -90,3 +93,15 @@ fn add_xephyr_run(b: *std.Build, exe: *std.Build.Step.Compile, multimon: bool) *
 
     return run_wm;
 }
+
+fn add_xwayland_run(b: *std.Build, exe: *std.Build.Step.Compile) *std.Build.Step.Run {
+    const cmd = "Xwayland -retro -noreset :2 & sleep 1";
+
+    const setup = b.addSystemCommand(&.{ "sh", "-c", cmd });
+
+    const run_wm = b.addRunArtifact(exe);
+    run_wm.step.dependOn(&setup.step);
+    run_wm.setEnvironmentVariable("DISPLAY", ":2");
+
+    return run_wm;
+}