Skip to content

Add Zig 0.15 support; require Zig 0.15.0 as minimum version#32

Open
trodemaster wants to merge 1 commit intojackielii:mainfrom
trodemaster:zig-0.15
Open

Add Zig 0.15 support; require Zig 0.15.0 as minimum version#32
trodemaster wants to merge 1 commit intojackielii:mainfrom
trodemaster:zig-0.15

Conversation

@trodemaster
Copy link
Copy Markdown

Zig 0.15 introduces several breaking API changes that prevent this project from building. This PR addresses all of them.

Breaking: Zig 0.14 and earlier are no longer supported.

Build system

  • build.zig.zon: set minimum_zig_version = "0.15.0"
  • build.zig: addExecutable/addTest now use root_module + b.createModule() — the top-level root_source_file field was removed in 0.15
  • Benchmark step disabled: zbench is not yet compatible with Zig 0.15

C import

  • c.zig: pub usingnamespace @cImport(...)pub const c_impl = @cImport(...) — re-exporting usingnamespace is no longer allowed
  • All call sites updated to use @import("c.zig").c_impl; NSApplicationLoad accessed via @import("c.zig").NSApplicationLoad()

Stdlib / language

  • std.ArrayListstd.array_list.Managed
  • std.time.sleepstd.Thread.sleep
  • stderr.reader() / .writer().deprecatedReader() / .deprecatedWriter()
  • std.posix.empty_sigsetstd.posix.sigemptyset()
  • callconv(.C)callconv(.c)

Format protocol

  • Custom format methods updated to: format(self, writer: anytype) !voidcomptime fmt and FormatOptions parameters removed in 0.15
  • Call sites that invoke the format method use {f} specifier
  • Mappings.format and Mode.format rewritten without allocation to match the error{WriteFailed}!void error set required by {f}

CI

  • Both jobs updated from Zig 0.14.0 to 0.15.2

Testing

Tested on macOS 26.3.1 (arm64) with Zig 0.15.2:

  • zig build test — all tests pass
  • zig build -Doptimize=ReleaseFast — succeeds
  • ./zig-out/bin/skhd --version — binary runs correctly
  • Ran as the active skhd daemon with an existing .skhdrc — hotkeys work

Breaking: Zig 0.14 and earlier are no longer supported.

Build system:
- build.zig.zon: minimum_zig_version = "0.15.0"
- build.zig: addExecutable/addTest use root_module + createModule()
  (root_source_file at the step level removed in 0.15)
- Benchmark step disabled: zbench is not yet compatible with Zig 0.15

C import:
- c.zig: pub usingnamespace @cImport(...) -> pub const c_impl = @cImport(...)
  (re-exporting usingnamespace is no longer allowed)
- All callers updated to use @import("c.zig").c_impl; NSApplicationLoad
  accessed via @import("c.zig").NSApplicationLoad()

Stdlib / language:
- std.ArrayList -> std.array_list.Managed
- std.time.sleep -> std.Thread.sleep
- stderr.reader() / .writer() -> .deprecatedReader() / .deprecatedWriter()
- std.posix.empty_sigset -> std.posix.sigemptyset()
- callconv(.C) -> callconv(.c)

Format protocol:
- Custom format methods updated to: format(self, writer: anytype) !void
  (comptime fmt and FormatOptions parameters removed in 0.15)
- Call sites that invoke the format method use {f} specifier
- Mappings.format and Mode.format rewritten without allocation to match
  the error{WriteFailed}!void error set required by {f}

CI:
- Both jobs updated from Zig 0.14.0 to 0.15.2
@trodemaster
Copy link
Copy Markdown
Author

Hi, thanks for reviving skhd in zig! I have been using skhd for many years. My eventual goal here with updating skhd.zig to zig 0.15.x is so I can create a macports port for skhd.zig. I have been using skhd.zig built with this branch for a week or so and it's working well for me. I did use cursor/claude to make this PR with manual testing for validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant