keyhac-key-table-configuration

Configure Keyhac key bindings, per-application key tables, and modifiers in config.py.

6|Updated Jul 26, 2026
One-click install
npx skills add https://github.com/crftwr/keyhac --skill keyhac-key-table-configuration-crftwr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: keyhac-key-table-configuration
Source: https://github.com/crftwr/keyhac/tree/main/keyhac/skills/keyhac-key-table-configuration
Command: npx skills add https://github.com/crftwr/keyhac --skill keyhac-key-table-configuration-crftwr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Editing a live Keyhac config.py is risky: a wrong key expression, a table condition that never matches, or a platform-specific modifier can silently break bindings, and an AI assistant cannot press keys to verify results. This Skill provides a disciplined read-edit-reload-verify loop for changing key bindings without breaking the user's existing configuration. ## Core Features & Use Cases - Safe config editing: Always reads config.py before writing, makes minimal changes, preserves the user's comments and idioms, and reloads with error checking. - Key table conditions: Guides correct use of app=, focus_path_pattern=, and class_name= conditions, including reading the live focus path via describe_keymap instead of guessing. - Platform trap avoidance: Catches silently dead bindings such as Cmd- on Windows, Win- on macOS, and the macOS Fn-arrow hardware remapping issue. - Use Case: A user says "make Ctrl-K open my notes, but only in VS Code." The Skill reads the config, captures the VS Code focus path, adds the binding to the right key table, reloads, confirms placement with describe_keymap, and asks the user to press the key. ## Quick Start Ask the assistant to change what a key does in Keyhac, for example "make Ctrl-Shift-N open a new terminal window only when I'm in my browser."

Frequently Asked Questions about keyhac-key-table-configuration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a key binding in Keyhac config.py?

Add a binding by assigning an action to a key expression in a key table, such as kt["Ctrl-K"] = some_action, then reload the config. The Skill reads the file first, makes a minimal edit, reloads it, and confirms placement with describe_keymap.

How do I make a Keyhac shortcut work only in one application?

Use a key table with an app= condition matching the application name, which is stable across window titles. For conditions based on a kind of control like a text field, use focus_path_pattern= read from the live focus path via describe_keymap.

Why is my Keyhac key binding not working?

Common causes are a later key table overriding the same key, a condition that never matches, or a config that failed to load leaving the old one running. Platform issues like Cmd- on Windows or Fn-arrow keys on macOS also produce silently dead bindings.

Does Keyhac key configuration work on both Windows and macOS?

Yes, one config.py runs on both platforms, but modifier names differ: Cmd- and Fn- never fire on Windows, and Win- never fires on macOS. Cross-platform configs should branch on keymap.platform or use the LEADER and MOD constants.

Can an AI assistant verify that a Keyhac binding works?

Only partially. It can confirm via describe_keymap that the binding loaded, sits in the intended table, and is not overridden, but it cannot press keys. The user must press the key to confirm the action does what they expect.

When should I write a Keyhac action instead of a key binding?

Use an action when the goal goes beyond a keystroke, such as driving another application's UI, reading a table, or filling a form. Actions are Python classes in ~/.keyhac/extensions/ that you bind to a key once written.