hott
Simple global hotkeys for Windows, with node
Install
npm i hott -g
Configuration
Hott currently has to be manually configured in the .hott
file found in your home directory (%USERPROFILE%
). The basic structure of a hotkey config file is:
- key: The virtual key code identifier for the key that the hotkey is bound against.
- modifiers: (optional) An array of modifier keys (currently, it must be an array even if it only had one item). Valid modifier keys are
MOD_SHIFT
,MOD_ALT
, andMOD_CONTROL
. - cmd: A string which will be executed using
child_process.exec
when the hotkey is triggered.
Programmatic usage
You can also use hott within scripts to establish (currently only global) key bindings and exec code, or invoke callbacks, when the hotkeys are pressed.
var hott = Api; // Register a hotkey to execute some code (using child_process.exec)hott; // Now accepting callbacks toohott; // Eval javascript!hott; // Or spawn a processhott; // You MUST then tell hott to monitor for the hotkeys being pressed!// You can pass in options if you want (currently only poll-rate, in ms)hott;
How it works
Hott uses native winapi methods to register global hotkeys, and monitors them using a daemonised process that always runs in the background. You can manually stop and restart the daemon using:
hott stop
and
hott start
Roadmap
Features which should be coming soon:
- CLI actions for adding, modifying and removing shortcuts more easily.
- Watching the
.hott
file for changes and refreshing the daemon as required. - Non-global key-binding via API.