home
tpb

repository View

fix: added os comptime check for running ForkOut

change ID
zwlvrkvuoynxktsqolyynksrumxkykuk
git commit
ec524f039c7af886a26bb401ba88eae4a5d31285
author
Grace Yoder <grace_yoder@outlook.com> - 2026-07-06T09:49:35-06:00
committer
Grace Yoder <grace_yoder@outlook.com> - 2026-07-06T17:15:47-06:00
parents
rqlxoyoyputs
refs
signature
Present (not validated)
fix: added os comptime check for running ForkOut

tree

type name size
file .crow/build.yml 1532 bytes
file .crow/release.yml 566 bytes
file .gitignore 354 bytes
file LICENSE 1073 bytes
file README.md 632 bytes
file build.zig 2345 bytes
file build.zig.zon 247 bytes
file src/Clip/ForkOut.zig 621 bytes
file src/Clip/NSPBBridge.m 382 bytes
file src/Clip/NSPasteboard.zig 1456 bytes
file src/Clip/OSC52.zig 4564 bytes
file src/Clip.zig 1560 bytes
file src/main.zig 2918 bytes

diff

src/main.zig

modified (file → file)

--- a/src/main.zig
+++ b/src/main.zig
@@ -45,16 +45,18 @@
     // 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;
+            }
         }
     }