This commit is contained in:
Alex Dima 2015-12-04 11:41:05 +01:00
Родитель 8eba2ed0c8
Коммит ee362cd565
3 изменённых файлов: 126 добавлений и 9 удалений

Просмотреть файл

@ -20,7 +20,9 @@ before_install:
- nvm use 4.1
- npm config set python `which python`
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9";
export CXX="g++-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
install:

121
README.md
Просмотреть файл

@ -1,4 +1,119 @@
# OS key mapping node module [![Build Status](https://travis-ci.org/alexandrudima/vscode-keyboard.svg?branch=master)](https://travis-ci.org/alexandrudima/vscode-keyboard)
Returns what characters are produced by pressing keys with different modifiers on the current system keyboard layout.
## Installing
```sh
npm install keymap
```
## Using
```javascript
var keymap = require('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
* TODO: 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](https://github.com/alexandrudima/vscode-keyboard/blob/master/License.txt)
Linux:
libx11-dev
`sudo apt-get install libx11-dev`

Просмотреть файл

@ -1,19 +1,19 @@
{
"name": "vscode-keyboard",
"name": "keymap",
"version": "0.0.1",
"description": "Utilities for keyboard layouts",
"description": "Get OS key mapping",
"main": "index.js",
"scripts": {
"test": "node test/test.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/vscode-keyboard.git"
"url": "git+https://github.com/alexandrudima/vscode-keyboard.git"
},
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Microsoft/vscode-keyboard/issues"
"url": "https://github.com/alexandrudima/vscode-keyboard/issues"
},
"homepage": "https://github.com/Microsoft/vscode-keyboard#readme"
"homepage": "https://github.com/alexandrudima/vscode-keyboard#readme"
}