← Keyhac English | 日本語 · crftwr/keyhac on GitHub · craftware

Installation

English | 日本語

Requirements

Keyhac runs entirely on your machine. It never connects to the internet — there is no update check and no telemetry. The one exception is a step you take yourself: Advanced > Sync Python Packages in the tray menu downloads the extra libraries you list in requirements.txt (see Configuration). Nothing reaches the network unless you choose it.

macOS

  1. Download Keyhac-<version>-macos.dmg from Releases, open it and drag Keyhac.app into Applications.
  2. Launch Keyhac. It is a menu-bar app — look for the keycap icon in the menu bar; there is no Dock icon.
  3. On first launch macOS asks for the Accessibility permission (System Settings → Privacy & Security → Accessibility; on macOS 12, System Preferences → Security & Privacy → Privacy → Accessibility). Keyhac’s keyboard hook cannot work without it. The permission is attached to the app bundle, so it survives updates.

To start Keyhac at login, add Keyhac.app in System Settings → General → Login Items.

Homebrew

brew install --cask crftwr/tap/keyhac

This installs the same DMG into Applications, so steps 2 and 3 above still apply. Since Keyhac never checks for updates, brew upgrade --cask keyhac is an easy way to stay current. It quits a running Keyhac before it replaces the app, so start Keyhac again afterwards.

Windows

Install Keyhac from the Microsoft Store, or from a terminal:

winget install --id 9P8H1PG6PRHH --source msstore

The Store delivers the build that matches your device, x64 or Arm. The package updates automatically, shows no SmartScreen warning, and is set to start at login by default — toggle that under Settings → Apps → Startup.

Zip package

  1. Download Keyhac-<version>-win-x64.zip (x64) or Keyhac-<version>-win-arm64.zip (Arm) from Releases and unzip it anywhere (for example C:\Program Files\Keyhac or a folder in your home directory).
  2. Run Keyhac.exe.
  3. If SmartScreen warns about an unrecognized app, choose “More info” → “Run anyway”.

To start the zip version at login, put a shortcut to Keyhac.exe into the Startup folder (Win-R → shell:startup).

After launching

Keyhac appears as a keycap icon in the task-tray notification area; the console window opens on first run.

Keyhac cannot see or modify keyboard input going to elevated (administrator) windows unless Keyhac itself runs elevated. This is a Windows security boundary; run Keyhac elevated only if you need your bindings inside elevated apps.

Running

The tray / menu-bar icon is the hub:

Menu item What it does
Open Console Shows the console window (log, hook toggle, log level, last-key / focus-path inspector)
Edit Config Opens ~/.keyhac/config.py in your editor (configurable — see configuration.md)
Reload Config Re-runs your config; errors keep the previous keymap active and appear in the console
Keyboard Hook Toggles the hook on/off (off = all keys pass through untouched)
Appearance Theme: Auto (follows the OS, the default), Light or Dark. Font Size: five sizes for Keyhac’s windows, from Extra Small to Extra Large; Medium is the default
Quit Keyhac Uninstalls the hook and exits

Closing the console window only hides it; Keyhac keeps running in the tray / menu bar. The console’s shown/hidden state is remembered across restarts.

Keyhac is single-instance: launching it while it is already running just re-shows the running instance’s console.

Data files

Everything lives under ~/.keyhac/ on both OSes:

File Contents
config.py Your configuration (created from the template on first run)
extensions/ On sys.path — put your own Python modules here and import them from config.py
clipboard.json Persisted clipboard history
settings.json App state (console visibility etc.)
diagnostics/ Reports you asked for from the Advanced menu, one folder each. Keyhac never deletes them

Running with --config PATH keeps clipboard.json and settings.json beside that config file instead — handy for a sandboxed or experimental setup.

If Keyhac is slow or busy (high CPU while idle, keys lagging), choose Advanced > Start Profiling in the tray / menu-bar menu while it is happening, wait a few seconds, and choose Advanced > Stop Profiling. Keyhac opens the folder it wrote under ~/.keyhac/diagnostics/; attach that folder to a GitHub issue. What the report holds is in Profiling.

Portable mode (Windows)

Put a config.py next to Keyhac.exe and that directory becomes the data directory — config, clipboard history and settings all live beside the executable and nothing is written to your user profile. This is the same portable mode Keyhac 1.x had, and the same opt-in: the file’s presence is the whole switch, so deleting it goes back to ~/.keyhac.

Use it for Keyhac on a USB stick, or to keep several independent setups side by side. Start from a copy of your existing ~/.keyhac/config.py, or of the template.

Two things still live outside a portable install: the console window’s remembered position (HKCU\Software\PuiKit\FrameAutosave) and keyhac-error.log, written to ~/.keyhac if Keyhac fails before its window opens. Neither affects your configuration.

Portable mode is Windows-only — a macOS .app is a signed bundle that Gatekeeper re-validates, so Keyhac cannot write into it. Use --config PATH there.

Note for Keyhac-for-Windows (1.x) users: the data directory moved from %APPDATA%\Keyhac to ~/.keyhac. On its first run Keyhac 2 spots a 1.x config.py there and offers to copy it across; it still needs an API migration pass afterwards — see migration-from-keyhac-win.md.

Privacy notes

Uninstall