English | 简体中文
AHKeyMap is an AutoHotkey v2–based keyboard and mouse remapping tool. It supports multiple configs active at the same time and process-scoped hotkeys, making it easy to build your own shortcut workflows.
AHKeyMap is useful if you:
- Want to map mouse buttons or wheel actions to keyboard shortcuts.
- Need the same hotkey to behave differently in different applications.
- Use multiple hotkey “profiles” and want to quickly enable/disable them.
Typical scenarios include:
- Browser tab navigation with mouse gestures.
- App-specific shortcuts for editors, design tools, or games.
- Quickly toggling between work and gaming configs.
- Multiple configs stored as simple
.inifiles inconfigs/. - Per-process scopes:
- Global: active in all apps.
- Include: active only in selected processes.
- Exclude: active everywhere except selected processes.
- Three hotkey paths for modifier behavior:
- Path A: simple remap without a modifier key.
- Path B: intercepting combos (modifier blocks its original behavior).
- Path C: passthrough combos (modifier keeps its native behavior, good for gestures).
- Long-press repeat with configurable delay and interval.
- Conflict detection across configs with a clickable status bar summary.
- Bilingual UI (English + Simplified Chinese), with language preference stored in
_state.ini.
- Install AutoHotkey v2 (64-bit).
- Clone or download this repository.
- Run
src\AHKeyMap.ahk(double-click or run viaAutoHotkey64.exe src\AHKeyMap.ahk).
Download AHKeyMap.exe from the GitHub Releases page and run it directly.
If you want to build the executable yourself:
build.batWhen launched without arguments, build.bat shows a small interactive menu:
Safe build: rununit,integration, then buildFull build: runall, then buildQuick build: skip tests and build immediately
All three modes write the packaged output to dist/.
For advanced or scripted usage, call scripts/build.ps1 directly. The PowerShell script locates Ahk2Exe and the AutoHotkey v2 base and produces dist/AHKeyMap.exe.
AHKeyMap now includes an automated regression suite for config logic, hotkey-engine behavior, and a lightweight GUI smoke flow.
Run the full suite locally:
pwsh ./scripts/test.ps1 -Suite allRun only the fast non-GUI suites:
pwsh ./scripts/test.ps1 -Suite unit,integrationCurrent suites:
unit: pure helper / formatting / scope logicintegration: config I/O, conflict detection, hotkey-engine stategui: in-process GUI smoke test for the main config workflow
Each *.test.ahk file runs in its own AutoHotkey process. Test runs use an isolated temporary config directory and do not modify your real configs/ folder.
Artifacts are written to test-results/:
logs/: one detailed log per test file, including suite metadata, per-testSTART/PASS/FAILlines, and failure details when a case breaksscreenshots/: desktop screenshots captured only when a GUI test failssummary.json: machine-readable run summary with suite / status / exit-code information
Real desktop input scenarios such as browser gestures, true global hotkeys, and timing-sensitive mouse/keyboard behavior are still tracked as manual end-to-end checks under tests/manual/.
- Launch AHKeyMap (script or EXE).
- In the main window:
- Click “New” to create a config.
- Choose a name and set the process scope (global / include / exclude).
- Add a mapping:
- Click “Add mapping”.
- Capture a modifier (optional), source key, and target key.
- Optionally enable repeat and adjust delay/interval.
- Save the mapping and make sure the config is checked as “Enable”.
- Switch to your target application and test the new hotkey.
For a concrete example, the following mapping in INI form (under configs/) makes the right mouse button + wheel up switch browser tabs backward:
[Meta]
Name=Browser tab switch
ProcessMode=include
Process=msedge.exe|chrome.exe|firefox.exe
ExcludeProcess=
[Mapping1]
ModifierKey=RButton
SourceKey=WheelUp
TargetKey=^+Tab
HoldRepeat=0
RepeatDelay=300
RepeatInterval=50
PassthroughMod=1- In a source checkout, configs live in the repo-root
configs/directory. In the packaged EXE build, the app uses a siblingconfigs/directory next toAHKeyMap.exe. - All configs live as separate
.inifiles. - Each config has:
[Meta]section: name and process scope.[MappingN]sections: individual hotkey mappings.
_state.inistores:- Last selected config name.
- Enabled/disabled flags per config.
- UI language (
UILanguage), currentlyen-USorzh-CN.
Basic fields:
ProcessMode:global,include, orexclude.Process/ExcludeProcess:|-separated process names.MappingN:ModifierKey,SourceKey,TargetKeyHoldRepeat(0/1)RepeatDelay,RepeatInterval(ms)PassthroughMod(0 = intercept, 1 = passthrough)
See docs/architecture.md for a deeper description of the hotkey engine and config format.
The AHKeyMap GUI currently supports:
- English (
en-US) - Simplified Chinese (
zh-CN)
On first run (when _state.ini has no UILanguage), the app defaults to English and then persists your choice in _state.ini:
UILanguage=en-USorUILanguage=zh-CN
You can change the UI language from the tray menu:
- Right-click the tray icon →
Language→ chooseEnglishor简体中文. - The main window and tray menu are rebuilt immediately; a full process restart is not required.
The config file format itself is language-agnostic; only the UI strings are localized.
- Chinese user guide: README.zh-CN.md
- Architecture and implementation notes: docs/architecture.md
- Agent/automation guidelines: AGENTS.md
- Automated test suites:
tests/ - Deferred bug backlog: docs/bug-backlog.md
AHKeyMap is released under the MIT License.