Skip to content
KeyChordPublic

About

All chord packages in one place.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Chord's (conventional) chords

Global Conventions

' Reserved for entering "insert mode"
\ Reserved for escape characters
0 Reserved for Chord
` Conventionally used for for "config" (e.g. 3`d2,i1`/w] waits 200 ms, then runs /w] (next window) three times, 100 ms apart) / Recommended for launcher apps
; Default prefix for all other global actions (can be overriden)

All other non-alphanumeric keys are free to be assigned to any global chords.

Define global chords and their hints in the package's root chords/macos.toml (for example, @keychord/chords-betterdisplay/chords/macos.toml), with any handlers they use. Keep application-specific alphanumeric chords in nested application/bundle-ID folders. Package builds reject global chords outside the root file.

Package prefixes

Packages that declare a prefix letter use Default Global Prefix for Placeholders under Settings → Chords. To change one package's prefix, open its Placeholders section.

Default prefix Package or actions
/ Finder (/f), System Settings (/,), and launcher search (/<query>)
;a AeroSpace
;b Menu bar, tray, Window menu, and system actions
;c Click and mouse movement
;d Dock
;k Modifier keys
;m Monitors and BetterDisplay
;n Navigation
;r Rift
;s Spaces
;w Native window commands

To change a chord's suffix or action, link a local copy of the package using Link Local Folder on its repo, then edit the chord there.

Local Conventions

l Left
r Right
u Up
d Down

n North / New
e East / End
s South / Start
w West

We typically assign the cardinal directions to distinguish between actions with a "move" equivalent. For example, "move pane left" would typically be assigned pl (pane left) while "focus pane left" would be assigned pw (pane west).

t Top
m Middle
c Center
b Bottom

f Front / Forward
k Back / Backward
a First
z Last

g Go to
q Quit
p Play
h Halt (i.e. pause)
i In / Inner / Inside
o Out / Outer / Outside

v Vary (i.e. toggle, on/off)
x No
y Yes
j Jump (i.e. focus)

[ Previous
] Next
- Decrease
= Increase
, Settings
. Left Click
., Right Click
.. Double Click
.; Middle Click (Rare)
/ Search

Note

This section is largely AI-written, so parts of it may not be fully accurate. It will be replaced with a hand-written version when I get the time.

Always single-quote binding keys in TOML [chords] tables, even when quotes are optional (for example, 'fr' = { name = 'Find and Replace' }). vp fmt preserves these quotes.

In TOML chord keys, only parenthesized sections use regex syntax; all surrounding keys are literal. Write hs.(\d+) to match hs.12 and pass 12 as $1. Dots outside parentheses need no backslash; dots inside a regex section still use \. when they must match literally. Chord patterns match the complete entered sequence automatically.

Installing packages

Add the KeyChord/chords monorepo in Chord and enable the packages you want, or add an individual GitHub mirror. The built-in macOS package list links each app to its package.

Linux and Windows

Use Chord 0.3.4 or later. Chord selects the current platform's TOML files at runtime. Linux bindings run in X11 sessions. Desktop shortcuts follow the defaults of the named window manager or application.

Package Linux Windows
Chord Controls, Click, Modifiers, Navigation Built-in controls, pointer actions, and shortcuts Built-in controls, pointer actions, and shortcuts
Dock, Finder, Menu, Monitors, Spaces, Windows, System Preferences GNOME or X11 desktop tools as documented by each package Taskbar, File Explorer, Settings, monitors, and virtual desktops
Chromium, JetBrains, Spotify, Terminal, VS Code, Warp App-specific shortcuts App-specific shortcuts
Instagram, LiveSplit One, Web, YouTube Dedicated browser profiles Dedicated browser profiles or WebView2
WhatsApp Dedicated Chromium app window WhatsApp for Windows
AeroSpace, Apple Music, Apple TV, Raycast, Screenshot — The documented Windows apps or port

The other Apple app packages use macOS apps or Accessibility and Swift APIs. BetterDisplay and Rift use their macOS apps. Each port's README lists the features and any setup it requires.

Development

Note

This section is largely AI-written, so parts of it may not be fully accurate. It will be replaced with a hand-written version when I get the time.

Setup

You need macOS on Apple Silicon, Vite+ (the global vp CLI, which drives pnpm for this workspace), Bun for tests, and a Swift 6.2+ toolchain (Xcode) to rebuild native add-ons. Chord runs handlers under Bun, so package tests do too.

Until the updated @keychord/config is published, pnpm-workspace.yaml links it to a sibling checkout at ../config, which has to be built before vp install here can load the package configs:

git clone https://github.com/KeyChord/config
git clone https://github.com/KeyChord/chords
(cd config && vp install && vp pack)
cd chords && vp install

Run vp pack in ../config again after changing the shared config.

  • vp check runs format, lint and type checks.
  • vp run test runs every package's Bun tests (bun test --isolate); vp run --filter @keychord/chords-click test runs one package. Don't use vp test, which runs Vitest under Node.
  • vp pack in a package directory builds its js/ output and native add-ons; vp run build from the root builds every package.

To try a local checkout in Chord, link it under Settings → Chords → Chord Monorepos → Local monorepos and tick the packages you're working on. Reload with 0,r after rebuilding.

Chord packages normally use export default config() from @keychord/config in vite.config.ts. Tests and their fixtures live in each package's __tests__/ directory.

All chord packages have a macOS VM smoke test. Run vp run test:macos:setup once, then vp run test:macos for the full suite or vp run test:macos -- @keychord/chords-click for one package. Each run uses a fresh Tart clone of a pinned, prepared macOS image. Shared helpers and fixture apps are exported by @keychord/chordtest.

Version control

This repository uses colocated Jujutsu (jj) and Git, following Haniverse's workflow with main as the integration branch. The checked-in .jj.toml provides repository-specific aliases, overriding any global aliases that target trunk.

To enable the same setup in a fresh Git checkout:

jj --config-file .jj.toml git init --colocate
cp .jj.toml "$(jj config path --repo)"
jj bookmark track main --remote origin

The config allows new files up to 10 MB, matching Haniverse and accommodating the native addons and generated bundles committed here. Re-run the cp command after changing .jj.toml to update the active local config.

jj --no-pager status
jj --no-pager diff --git
jj --no-pager log
jj gf                              # fetch without rebasing
jj describe -m "Describe the change"
jj push                            # advance main and push to origin

jj push selects the latest described, non-empty commit in the current working copy's ancestry and leaves working files in place. It forwards arguments to jj git push; jj push --dry-run previews the remote update but still advances the local main bookmark.

jj pull fetches origin, resets the local main bookmark to main@origin, and rebases current work onto it. Coordinate before running it in a shared checkout. Describing and pushing the current working copy includes all edits in that revision, so review them first. Jujutsu does not run Git hooks; run vp check and vp run test (Bun tests in every package) before pushing.

A pre-commit hook formats staged JS, TS, TSX, JSON, and TOML files. To enable the hooks in a fresh Git clone:

vp config --hooks-dir .vite-hooks

Native add-ons

Packages with a Package.swift at their root ship NodeSwift add-ons built from their Swift sources (usually Sources/). vp pack in such a package compiles them through @keychord/config, stages them in target/<triple>/, and bundles hashed copies with their runtime libraries under js/native/. They can only be compiled on macOS, so the built files are committed. Mirrors copy all committed files, including JS and native artifacts, as-is. Build and commit generated handlers before pushing changes to their source.

With moon installed, moon run ':build-native' rebuilds the packages listed in .moon/workspace.yml. Native artifact checks are manual because rebuilding addons can be slow: vp run native:check checks that Swift module names are unique across packages, rebuilds with moon, and fails if any committed .node file's machine code differs from the rebuild. Commit the rebuilt target/ and js/ files when it does.

Mach-O output is not byte-reproducible -- the linker mints a fresh LC_UUID each run -- so the check compares disassembled machine code rather than file hashes, and every genuine rebuild rewrites the binaries.

Repository mirrors

The Sync workflow mirrors every directory @keychord/<name> to https://github.com/KeyChord/<name>, including private workspace packages such as chordtest. No list or manifest opt-in is required, and repository.url does not control mirroring. Missing repositories are created as public repositories. Not every package has a mirror at the moment; install those through the monorepo (see Installing packages).

KeyChord/chords is the source of truth. The Sync workflow force-replaces each mirror's main with an independent snapshot of the committed package directory; mirror-only commits and files are discarded. Uncommitted files, local build outputs and node_modules never enter a snapshot. Committed executable modes and symlinks are preserved. Replaying the same source produces the same commit. Tags on the source commit named <name>-js-v<version> are force-synced as v<version> even on a repeat run. Older mirror release tags are retained.

Mirrors are read-only distribution repositories: contribute changes here. The workflow sets their description and homepage to point here and disables issues, projects, discussions and wikis. It runs on every push to main, hourly to repair drift, and through manual dispatch. Runs are serialized and always check out the latest main. There is no sync from a mirror back into this repo.

The existing ORG_KEYCHORD_BOT_PAT Actions secret must have permission to create public repositories in the KeyChord organization, push (including force pushes) to all mirrors, and update repository settings. A classic PAT needs public_repo (or repo); organization policies must also permit repository creation and force pushes. Newly created mirrors must be accessible to the same token.

Mirror tooling lives in two private workspace packages under packages/dev/improve/chords/configs/mirrors:

  • @chord/dev.improve.chords.configs.mirrors.list in list/ discovers destinations and provides the _list-mirrors command. Run vp run mirrors:list from the repository root to inspect destinations.

  • @chord/dev.improve.chords.configs.mirrors.sync in sync/ depends on the list package and provides the _sync-mirrors command. The Sync workflow calls it through the root mirrors:sync script. With CI unset, it creates temporary local snapshots without contacting GitHub or changing package directories:

    env -u CI BUILD_BASE="$PWD/@keychord" GITHUB_REF=refs/heads/main GITHUB_SHA=HEAD vp run mirrors:sync

The workflow is authored in packages/dev/improve/chords/configs/mirrors/sync/sync.wac.ts, using github-actions-workflow-ts as in Haniverse. Run vp run workflows:build after editing it and commit the generated .github/workflows/sync.yml. vp install also regenerates workflows through the root postinstall. Do not edit generated YAML directly; the workflow checks that regeneration leaves it unchanged.

The native artifact checker lives in packages/dev/improve/chords/configs/native. All three tooling packages run TypeScript directly on Node.js 22.18 or newer. Third-party runtime helpers are accessed through wrappers in packages/com/npmjs/; scoped names use scope__name directory names.

About

All chord packages in one place.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages