npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

traykit-bindings

v0.1.4

Published

Zig-powered macOS tray (menu bar) bindings for Bun (Bun-only).

Readme

TrayKit Bun Bindings (Bun only)

This package is Bun-only. It targets the Bun runtime and is not designed to run on plain Node.js.

These bindings expose a small TypeScript client that controls the TrayKit native macOS menu bar app from a Bun process (add/remove menu items, handle clicks, etc.).
Published npm package name: traykit-bindings.


Installation (Bun project)

In your Bun project:

bun add traykit-bindings

Requirements:

  • macOS (menu bar / status item)
  • Bun runtime (uses bun spawn, bun:test, etc.)

Quick start

Create a script in your Bun + TypeScript project, for example tray.ts:

import TrayKit from "traykit-bindings";

const client = TrayKit.createClient({
  // Optional: default config JSON; if omitted, a built-in default is used.
  configJson: TrayKit.defaultConfigJson(),
  // Optional: binaryPath, debug, etc.
});

await client.addText({ title: "Hello from TrayKit" });
await client.addAction({ title: "Quit", key_equivalent: "q" });

Run with Bun:

bun tray.ts

By default the client starts the bundled native binary from the package’s bin/zig-traykit.
If you have your own custom build, override binaryPath:

const client = TrayKit.createClient({
  binaryPath: "/your/custom/path/zig-traykit",
});

API overview

The client is fully typed for Bun + TypeScript. Core entry points:

  • TrayKit.createClient(opts?: TrayClientOptions): TrayClient
  • TrayKit.defaultConfigJson(): string
  • TrayKit.Client constructor (lower-level usage)

TrayClientOptions

type TrayClientOptions = {
  binaryPath?: string;  // Custom path to the Zig binary
  configJson?: string;  // Initial configuration JSON
  debug?: boolean;      // Enable debug logging
};

Main instance methods

  • addText({ title, is_separator?, index? })
  • addAction({ title, key_equivalent?, index?, onClick? })
  • removeItem(index)
  • clearItems()
  • list()
  • setIcon(params) Example:
await client.addText({ title: "Title", is_separator: false });

await client.addAction({
  title: "Click me",
  key_equivalent: "c",
  onClick: () => {
    console.log("tray item clicked");
  },
});

TrayKit.defaultConfigJson() returns a minimal config with an icon and no menu items.
If you want a richer default menu, build your own JSON config and pass it into createClient.


Local development in this repo

If you are working inside the TrayKit repo on the bindings, you can use the built-in demo:

cd ts-bindings
bun install
bun run demo.ts

Before publishing to npm, the prepublishOnly script will automatically:

  1. Build the macOS native binary with Zig (using ReleaseSmall optimize mode).
  2. Copy the binary into ts-bindings/bin/zig-traykit.
  3. Run bun test to perform basic integration checks and ensure the binary can be found and started.