Week 6 - Contributions

I’ve opted to make code contributions After evaluating Ghostty to be a good project to work on last week, I’ve been working on contributions to the project. While working on any large project is initially daunting, Ghostty’s codebase is remarkably well written. It helps that the main contributor has some experience writing industry-standard cloud infra tools like Consul, Vault, and Terraform.

Of my two pull requests to Ghostty, #5977 and #5995, only the former has been merged.

The first pull request fixes a bug with configuring keybinds. At a high level, when the keybind setting was left empty in the config file, keybinds were cleared instead of reverting to defaults as expected. This was my first time making a contribution to Ghostty, and it took me a little bit to get familiar with programming patterns in Zig. In particular, I was a little surprised to learn that Zig doesn’t have a concept of traits. Instead, the idiomatic pattern is to use “comptime,” a form of meta programming where you write code that generates code at compile time. The initial fix in my PR was hacky because of my unfamilarity with the project and language and resulted in a few comments in the code review. Thankfully, the project maintainers were helpful and guided me towards making a proper fix that used comptime. This was a great experience with the community and motivated me to make another PR.

My next PR was a lot simpler and fixes a bug that repeatedly writes the selected text in the terminal to the clipboard. A previous attempt in another PR at fixing the issue resulted in another bug and went stale, so I decided to work take it on. The fix itself was straightforward, and I’m waiting for it to get reviewed and hopefully merged.

Ultimately, the biggest challenge with working on Ghostty is getting familiar with Zig. I’m still not too familiar with comptime and with the intricacies of memory allocation, but gaining more experience will help. I’m still looking to make more, smaller contributions, but I’m currently limiting myself to programming projects I depend on rather than editing Wikipedia entries or mapping on OpenStreetMaps.

Written before or on March 2, 2025