<commit_before># global-shortcut

The `global-shortcut` module can register/unregister a global keyboard shortcut
in operating system, so that you can custom the operations for various shortcuts.
Note that it is global, even the app does not get focused, it still works.

```javascript
var globalShortcut = require('global-shortcut');

// Register a 'ctrl+x' shortcut listener.
var ret = globalShortcut.register('ctrl+x', function() { console.log('ctrl+x is pressed'); })
if (!ret)
  console.log('registerion fails');

// Check whether a shortcut is registered.
console.log(globalShortcut.isRegistered('ctrl+x'));

// Unregister a shortcut.
globalShortcut.unregister('ctrl+x');

// Unregister all shortcuts.
globalShortcut.unregisterAll();
```

## globalShortcut.register(accelerator, callback)

* `accelerator` [Accelerator](accelerator.md)
* `callback` Function

Registers a global shortcut of `accelerator`, the `callback` would be called when
the registered shortcut is pressed by user.

## globalShortcut.isRegistered(accelerator)

* `accelerator` [Accelerator](accelerator.md)

Returns whether shortcut of `accelerator` is registered.<commit_msg>:memo: Fix english errors and clarify docs<commit_after># global-shortcut

The `global-shortcut` module can register/unregister a global keyboard shortcut
in operating system, so that you can customize the operations for various shortcuts.
Note that the shortcut is global, even if the app does not get focused, it will still work.

```javascript
var globalShortcut = require('global-shortcut');

// Register a 'ctrl+x' shortcut listener.
var ret = globalShortcut.register('ctrl+x', function() { console.log('ctrl+x is pressed'); })
if (!ret)
  console.log('registerion fails');

// Check whether a shortcut is registered.
console.log(globalShortcut.isRegistered('ctrl+x'));

// Unregister a shortcut.
globalShortcut.unregister('ctrl+x');

// Unregister all shortcuts.
globalShortcut.unregisterAll();
```

## globalShortcut.register(accelerator, callback)

* `accelerator` [Accelerator](accelerator.md)
* `callback` Function

Registers a global shortcut of `accelerator`, the `callback` would be called when
the registered shortcut is pressed by user.

## globalShortcut.isRegistered(accelerator)

* `accelerator` [Accelerator](accelerator.md)

Returns `true` or `false` depending on if the shortcut `accelerator` is registered.
{'fraction_non_alphanumeric': 0.11176470588235295, 'fraction_numerical': 0.0, 'mean_word_length': 5.822349570200573, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1653989', 'n_tokens_mistral': 709, 'n_tokens_neox': 671, 'n_words': 231}