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("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(b.path("protocol/wlr-layer-shell-unstable-v1.xml"));
16    scanner.addCustomProtocol(b.path("protocol/river-status-unstable-v1.xml"));
17    scanner.addCustomProtocol(b.path("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("pixman", .{}).module("pixman");
32    const fcft = b.dependency("fcft", .{}).module("fcft");
33
34    const time = b.addTranslateC(.{
35        .root_source_file = b.addWriteFiles().add("z_time.h",
36            \\#include <time.h>
37        ),
38        .target = target,
39        .optimize = optimize,
40    });
41
42    const exe = b.addExecutable(.{
43        .name = "creek",
44        .root_module = b.createModule(.{
45            .root_source_file = b.path("src/main.zig"),
46            .target = target,
47            .optimize = optimize,
48            .link_libc = true,
49        }),
50    });
51    exe.pie = pie;
52
53    exe.root_module.addImport("wayland", wayland);
54    exe.root_module.linkSystemLibrary("wayland-client", .{});
55
56    exe.root_module.addImport("pixman", pixman);
57    exe.root_module.linkSystemLibrary("pixman-1", .{});
58
59    exe.root_module.addImport("fcft", fcft);
60    exe.root_module.linkSystemLibrary("fcft", .{});
61
62    exe.root_module.addImport("time", time.createModule());
63
64    b.installArtifact(exe);
65
66    const run = b.addRunArtifact(exe);
67    run.step.dependOn(b.getInstallStep());
68    run.addPassthruArgs();
69
70    const run_step = b.step("run", "Run creek");
71    run_step.dependOn(&run.step);
72}