Register user-configurable global shortcuts for HyperTerm which respect config changes
npm install hyperterm-register-shortcutFor the configKey foo, hyperterm-register-shortcut will look for the user's preferred hotkey in following order:
- config.hotkeys.foo
- config.foo.hotkey
- config.fooShortcut
First, import the helper from hyperterm-register-shortcut
``js`
const registerShortcut = require('hyperterm-register-shortcut');
Then use registerShortcut to create an onApp method to export:
`js
const configKey = 'YOUR_SHORTCUT_NAME';
const defaultShortcut = 'Ctrl+;';
function foo (app) {
// do something with app
console.log('bar');
}
module.exports = {
onApp: registerShortcut(configKey, foo, defaultShortcut)
}
`onApp
Or, if you have other work you need to do inside , export your own function which calls registerShortcut then calls the function returned from it with app as the parameter
`js
const configKey = 'YOUR_SHORTCUT_NAME';
function foo () {
// do something with app
console.log('bar');
}
module.exports = {
onApp: (app) => {
// do some other onApp stuff first
registerShortcut(configKey, foo)(app)
}
}
``