Use [pnpm] because it supports specifying a dependency which is subdirectory of a GitHub repository, which is necessary since LLRT doesn't have an npm package for its types:
Make sure your tsconfig.json has the types property set to llrt-types:
// tsconfig.json
{
"compilerOptions": {
"types": ["llrt-types"]
// ...
}
}- nano-spawn-compat - A more ergonomic
child_process.spawnthat works in LLRT. - bplist-lossless - A binary plist parser specifically tailored for edits by avoiding loss of precision during parsing and re-serialization.
- doctor-json - A JSON editor that preserves all existing formatting/comments
- keycode-ts2 - A TypeScript port of the Rust
keycodecrate which uses the Chromium keycode names as the source of truth (Chords uses these keycode names as the source of truth).
The built-in chord module also exposes:
export class Applescript {
constructor(source: string);
constructor(fn: (...args: unknown[]) => unknown, ...args: unknown[]);
compile(): void;
execute(): unknown;
}
export function setAppNeedsRelaunch(bundleId: string, needsRelaunch: boolean): void;This marks or clears an app in the settings UI and gives the user a one-click relaunch button.
Applescript uses the macOS OSAKit framework via the Rust osakit crate. Call compile() before execute().
When constructed with a string it runs AppleScript source directly. When constructed with a function, Chord serializes the trailing args, uses fn.toString(), wraps it as JXA, and executes it as JavaScript in OSAKit.
Chord registers the chord: URL scheme on macOS so scripts and launcher tools can trigger app actions.
settingsopen-settingsshow-settingsreload-configreload-configs
# Open the settings window
open --background 'chord:settings'
# Open the settings window (host-style form)
open --background 'chord://settings'
# Reload chord configs
open --background 'chord:reload-config'This repo also includes a small chord CLI wrapper that forwards commands to the chord: URL scheme.
settingsopen-settingsshow-settingsreload-configreload-configs
./chord settings
./chord reload-configsIf you want to run it as chord from anywhere, add the repo copy to your PATH or symlink it into a directory that is already on your PATH.
The CLI depends on macOS recognizing the bundled Chord app as the handler for the chord: URL scheme, so the app bundle needs to be built and launched at least once first.
Deno has too much overhead, an experiment was previously tried but it makes the keypress handler lag significantly (maybe I embedded it wrong, but not worth the trouble of debugging).
Bun on the other hand is great, but doesn't have an official integration API, which makes it impossible to expose custom Rust functions (needed in order to synchronize state). It can still be used for one-off CLI tasks such as browser automation, though.