creek

A malleable and minimalist status bar for the River compositor

git clone https://git.8pit.net/creek.git

 1const std = @import("std");
 2
 3const Scanner = @import("zig-wayland").Scanner;
 4
 5pub fn build(b: *std.Build) void {
 6    const target = b.standardTargetOptions(.{});
 7    const optimize = b.standardOptimizeOption(.{});
 8    const pie = b.option(bool, "pie", "Build a position-independent executable") orelse false;
 9
10    const scanner = Scanner.create(b, .{});
11
12    scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
13    scanner.addSystemProtocol("stable/viewporter/viewporter.xml");
14    scanner.addSystemProtocol("staging/single-pixel-buffer/single-pixel-buffer-v1.xml");
15    scanner.addCustomProtocol("protocol/wlr-layer-shell-unstable-v1.xml");
16    scanner.addCustomProtocol("protocol/river-status-unstable-v1.xml");
17    scanner.addCustomProtocol("protocol/river-control-unstable-v1.xml");
18
19    scanner.generate("wl_compositor", 4);
20    scanner.generate("wl_subcompositor", 1);
21    scanner.generate("wl_shm", 1);
22    scanner.generate("wl_output", 3);
23    scanner.generate("wl_seat", 5);
24    scanner.generate("wp_single_pixel_buffer_manager_v1", 1);
25    scanner.generate("wp_viewporter", 1);
26    scanner.generate("zwlr_layer_shell_v1", 1);
27    scanner.generate("zriver_status_manager_v1", 2);
28    scanner.generate("zriver_control_v1", 1);
29
30    const wayland = b.createModule(.{ .root_source_file = scanner.result });
31    const pixman = b.dependency("zig-pixman", .{}).module("pixman");
32    const fcft = b.dependency("zig-fcft", .{}).module("fcft");
33
34    const exe = b.addExecutable(.{
35        .name = "creek",
36        .root_source_file = b.path("src/main.zig"),
37        .target = target,
38        .optimize = optimize,
39    });
40    exe.pie = pie;
41
42    exe.linkLibC();
43    exe.root_module.addImport("wayland", wayland);
44    exe.linkSystemLibrary("wayland-client");
45
46    exe.root_module.addImport("pixman", pixman);
47    exe.linkSystemLibrary("pixman-1");
48
49    exe.root_module.addImport("fcft", fcft);
50    exe.linkSystemLibrary("fcft");
51
52    // TODO: remove when https://github.com/ziglang/zig/issues/131 is implemented
53    scanner.addCSource(exe);
54
55    b.installArtifact(exe);
56
57    const run = b.addRunArtifact(exe);
58    run.step.dependOn(b.getInstallStep());
59    if (b.args) |args| {
60        run.addArgs(args);
61    }
62
63    const run_step = b.step("run", "Run creek");
64    run_step.dependOn(&run.step);
65}