|
| 1 | +[](https://github.com/allyourcodebase/libxkbcommon/actions) |
| 2 | + |
| 3 | +# libxkbcommon |
| 4 | + |
| 5 | +This is [libxkbcommon](https://github.com/xkbcommon/libxkbcommon), packaged for [Zig](https://ziglang.org/). |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +First, update your `build.zig.zon`: |
| 10 | + |
| 11 | +``` |
| 12 | +# Initialize a `zig build` project if you haven't already |
| 13 | +zig init |
| 14 | +zig fetch --save git+https://github.com/allyourcodebase/libxkbcommon.git |
| 15 | +``` |
| 16 | + |
| 17 | +You can then import `libxkbcommon` in your `build.zig` with: |
| 18 | + |
| 19 | +```zig |
| 20 | +const libxkbcommon_dependency = b.dependency("libxkbcommon", .{ |
| 21 | + .target = target, |
| 22 | + .optimize = optimize, |
| 23 | +
|
| 24 | + // Set the XKB config root. |
| 25 | + // Will default to "${INSTALL_PREFIX}/share/X11/xkb" i.e. `zig-out/share/X11/xkb`. |
| 26 | + // Most distributions will use `/usr/share/X11/xkb`. |
| 27 | + // |
| 28 | + // The value `""` will not set a default config root directory. |
| 29 | + // To configure the config root at runtime, use the "XKB_CONFIG_ROOT" environment variable. |
| 30 | + // |
| 31 | + // This example will assume that the config root of the host system is in `/usr`. |
| 32 | + // This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS. |
| 33 | + .@"xkb-config-root" = "/usr/share/X11/xkb", |
| 34 | +
|
| 35 | + // The X locale root. |
| 36 | + // Will default to "${INSTALL_PREFIX}/share/X11/locale" i.e. `zig-out/share/X11/locale`. |
| 37 | + // Most distributions will use `/usr/share/X11/locale`. |
| 38 | + // |
| 39 | + // To configure the config root at runtime, use the "XLOCALEDIR" environment variable. |
| 40 | + // |
| 41 | + // This example will assume that the config root of the host system is in `/usr`. |
| 42 | + // This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS. |
| 43 | + .@"x-locale-root" = "/usr/share/X11/locale", |
| 44 | +}); |
| 45 | +your_exe.linkLibrary(libxkbcommon_dependency.artifact("libxkbcommon")); |
| 46 | +``` |
| 47 | + |
| 48 | +For more information, please refer to the [User-configuration](https://github.com/xkbcommon/libxkbcommon/blob/master/doc/user-configuration.md) docs of libxkbcommon. |
0 commit comments