Type text using wayland's input-method-unstable-v2 protocol. Written in zig ⚡
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 57 lines 1.9 kB view raw
1const std = @import("std"); 2const Scanner = @import("wayland").Scanner; 3 4pub fn build(b: *std.Build) void { 5 const target = b.standardTargetOptions(.{}); 6 const optimize = b.standardOptimizeOption(.{}); 7 8 const scanner = Scanner.create(b, .{}); 9 const wayland = b.createModule(.{ .root_source_file = scanner.result }); 10 11 scanner.addCustomProtocol(b.path("./protocols/input-method-unstable-v2.xml")); 12 scanner.addCustomProtocol(b.path("./protocols/text-input-unstable-v3.xml")); 13 14 scanner.generate("wl_seat", 2); 15 scanner.generate("zwp_input_method_manager_v2", 1); 16 scanner.generate("zwp_text_input_manager_v3", 1); 17 18 const exe = b.addExecutable(.{ 19 .name = "zw-type", 20 .root_module = b.createModule(.{ 21 .root_source_file = b.path("src/main.zig"), 22 .target = target, 23 .optimize = optimize, 24 .strip = true, 25 .link_libc = true, 26 }), 27 }); 28 29 exe.root_module.addImport("wayland", wayland); 30 exe.root_module.linkSystemLibrary("wayland-client", .{}); 31 32 b.installArtifact(exe); 33 34 const main_tests = b.addTest(.{ 35 .root_module = b.createModule(.{ 36 .root_source_file = b.path("src/main.zig"), 37 .target = target, 38 .optimize = optimize, 39 .link_libc = true, 40 }), 41 }); 42 main_tests.root_module.addImport("wayland", wayland); 43 main_tests.root_module.linkSystemLibrary("wayland-client", .{}); 44 45 const run_main_tests = b.addRunArtifact(main_tests); 46 const test_step = b.step("test", "Run unit tests"); 47 test_step.dependOn(&run_main_tests.step); 48 49 const run_step = b.step("run", "Run the program"); 50 const run_cmd = b.addRunArtifact(exe); 51 run_step.dependOn(&run_cmd.step); 52 run_cmd.step.dependOn(b.getInstallStep()); 53 54 if (b.args) |args| { 55 run_cmd.addArgs(args); 56 } 57}