Code Monkey home page Code Monkey logo

node-native-keymap's Introduction

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

  • On Debian-based Linux: sudo apt-get install libx11-dev
  • On Red Hat-based Linux: sudo yum install libx11-devel.x86_64 # or .i686
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
  • npm install -g node-gyp
  • node-gyp configure
  • node-gyp build
  • npm test

License

MIT

node-native-keymap's People

Contributors

alexdima avatar jrieken avatar tyriar avatar

Watchers

pbnj.io avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.