zeke / electron-shortcut-normalizer

Normalize electron keyboard shortcuts so they work on different operating systems
http://npm.im/electron-shorcut-normalizer
13 stars 3 forks source link

electron-shortcut-normalizer

Normalize electron keyboard shortcuts so they work on different operating systems.

shortcut

Installation

npm install electron-shortcut-normalizer --save

Usage

const normalize = require("electron-shortcut-normalizer")

normalize('Ctrl+A')
// => 'CommandOrControl+A'

normalize('CommandOrControl+Z', process.platform)
// => 'Command+Z' on Mac OS X
// => 'Control+Z' on Windows and Linux

normalize('CmdOrCtrl+a', 'darwin')
// => 'Command+A'

normalize('CmdOrCtrl+a', 'win32')
// => 'Control+A'

// `Option` is unique to Mac OS X, so it's normalized to `Alt`:
normalize('Option+Up')
// => 'Alt+Up'

For more specific usage information, see test.js

See Also

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

License

MIT

Generated by package-json-to-readme