Have ideas to improve npm?Join in the discussion! »

    hyperterm-register-shortcut

    1.3.0 • Public • Published

    hyperterm-register-shortcut Build Status

    Register user-customisable global shortcuts for HyperTerm which respect config changes. This module is designed to be used by HyperTerm plugins to implement global shortcuts and can't be installed as a plugin itself.

    For 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

    Usage

    First, import the helper from hyperterm-register-shortcut

    const registerShortcut = require('hyperterm-register-shortcut');

    Then use registerShortcut to create an onApp method to export:

    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)
    }

    Or, if you have other work you need to do inside onApp, export your own function which calls registerShortcut then calls the function returned from it with app as the parameter

    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)
      }
    }

    Install

    npm i hyperterm-register-shortcut

    DownloadsWeekly Downloads

    71

    Version

    1.3.0

    License

    ISC

    Last publish

    Collaborators

    • avatar
    • avatar