Provide OS keyboard layout functionality as a nodejs module
Перейти к файлу
Johannes Rieken 315679d486 add support for mac 2015-12-11 16:57:46 +01:00
.vscode Renames 2015-12-04 10:45:43 +01:00
deps/chromium add support for mac 2015-12-11 16:57:46 +01:00
src add support for mac 2015-12-11 16:57:46 +01:00
test Minor renames 2015-12-04 10:51:51 +01:00
.gitignore pick different npm name 2015-12-04 11:48:08 +01:00
.npmignore pick different npm name 2015-12-04 11:48:08 +01:00
.travis.yml Update README 2015-12-04 11:41:05 +01:00
License.txt Add Copyright headers 2015-12-04 10:45:44 +01:00
README.md add support for mac 2015-12-11 16:57:46 +01:00
ThirdPartyNotices.txt Add ThirdPartyNotices.txt 2015-12-04 10:45:45 +01:00
binding.gyp add support for mac 2015-12-11 16:57:46 +01:00
index.js Try not to fail 2015-12-04 12:05:15 +01:00
package.json Try not to fail 2015-12-04 12:05:15 +01:00

README.md

OS key mapping node module Build Status

Returns what characters are produced by pressing keys with different modifiers on the current system keyboard layout.

Installing

npm install native-keymap

Using

var keymap = require('native-keymap');
console.log(keymap.getKeyMap());

Example output when using standard US keyboard layout:

[
  ...
  { key_code: 'VKEY_OEM_2',
    value: '/',
    withShift: '?',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_3',
    value: '`',
    withShift: '~',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_4',
    value: '[',
    withShift: '{',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_5',
    value: '\\',
    withShift: '|',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_6',
    value: ']',
    withShift: '}',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_7',
    value: '\'',
    withShift: '"',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_102',
    value: '\\',
    withShift: '|',
    withAltGr: '',
    withShiftAltGr: '' } ]

Example output when using German (Swiss) keyboard layout:

[
  ...
  { key_code: 'VKEY_OEM_2',
    value: '§',
    withShift: '°',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_3',
    value: '',
    withShift: '¨!',
    withAltGr: ']',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_4',
    value: '\'',
    withShift: '?',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_5',
    value: '´ä',
    withShift: 'à',
    withAltGr: '{',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_6',
    value: '',
    withShift: '^`',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_7',
    value: '~ö',
    withShift: 'é',
    withAltGr: '',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_8',
    value: '$',
    withShift: '£',
    withAltGr: '}',
    withShiftAltGr: '' },
  { key_code: 'VKEY_OEM_102',
    value: '<',
    withShift: '>',
    withAltGr: '\\',
    withShiftAltGr: '' } ]

Supported OSes

  • linux (X11)
  • windows
  • mac

Developing

  • only tested on node v4.1.1
  • on linux: sudo apt-get install libx11-dev
  • npm install -g node-gyp
  • node-gyp configure
  • node-gyp build
  • npm test

License

MIT