diff options
| author | Grace Yoder <grace_yoder@outlook.com> | 2026-07-06 09:49:35 -0600 |
|---|---|---|
| committer | Grace Yoder <grace_yoder@outlook.com> | 2026-07-06 17:15:47 -0600 |
| commit | ec524f039c7af886a26bb401ba88eae4a5d31285 (patch) | |
| tree | 2167dfdcb39cff1dca3922b983b34fcb72ce74b8 /src | |
| parent | c228995f20e16a97ad6baff05a0d46d3fffe3295 (diff) | |
fix: added os comptime check for running ForkOut
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig index 60b498d..36c5bde 100644 --- a/src/main.zig +++ b/src/main.zig @@ -45,16 +45,18 @@ pub fn main(init: std.process.Init) !void { // I don't like this but it will stay until I review how dispatch works // with zig since I will probably be refactoring there linux: { - const xdg_type = init.environ_map.get("XDG_SESSION_TYPE") orelse ""; + if (comptime os == .linux) { + const xdg_type = init.environ_map.get("XDG_SESSION_TYPE") orelse ""; - if (std.mem.eql(u8, xdg_type, "wayland")) { - var clip = Clip.ForkOut.init(io, &[_][]const u8{"wl-copy"}) catch break :linux; - try run(io, &clip); - return; - } else if (std.mem.eql(u8, xdg_type, "x11")) { - var clip = Clip.ForkOut.init(io, &[_][]const u8{ "xclip", "-selection", "clipboard" }) catch break :linux; - try run(io, &clip); - return; + if (std.mem.eql(u8, xdg_type, "wayland")) { + var clip = Clip.ForkOut.init(io, &[_][]const u8{"wl-copy"}) catch break :linux; + try run(io, &clip); + return; + } else if (std.mem.eql(u8, xdg_type, "x11")) { + var clip = Clip.ForkOut.init(io, &[_][]const u8{ "xclip", "-selection", "clipboard" }) catch break :linux; + try run(io, &clip); + return; + } } } |
