add xwayland run step to build.zig
Browse files
+15 −0 build.zig
| @@ -65,6 +65,9 @@ pub fn build(b: *std.Build) void { | ||
| 65 | 65 | const multimon_step = b.step("multimon", "Alias for xephyr-multi"); |
| 66 | 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 | 71 | const kill_step = b.step("kill", "Kill Xephyr and oxwm"); |
| 69 | 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 | 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 | +} |