Git Product home page Git Product 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 libxkbfile-dev
  • On Red Hat-based Linux: sudo yum install libx11-devel.x86_64 libxkbfile-devel.x86_64 # or .i686
  • On SUSE-based Linux: sudo zypper install libX11-devel libxkbfile-devel
  • On FreeBSD: sudo pkg install libX11
npm install native-keymap

Using

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

Example output when using standard US keyboard layout (on Windows):

[
  ...
  Space:        { vkey: 'VK_SPACE',      value: ' ',  withShift: ' ', withAltGr: '', withShiftAltGr: '' },
  Minus:        { vkey: 'VK_OEM_MINUS',  value: '-',  withShift: '_', withAltGr: '', withShiftAltGr: '' },
  Equal:        { vkey: 'VK_OEM_PLUS',   value: '=',  withShift: '+', withAltGr: '', withShiftAltGr: '' },
  BracketLeft:  { vkey: 'VK_OEM_4',      value: '[',  withShift: '{', withAltGr: '', withShiftAltGr: '' },
  BracketRight: { vkey: 'VK_OEM_6',      value: ']',  withShift: '}', withAltGr: '', withShiftAltGr: '' },
  Backslash:    { vkey: 'VK_OEM_5',      value: '\\', withShift: '|', withAltGr: '', withShiftAltGr: '' },
  Semicolon:    { vkey: 'VK_OEM_1',      value: ';',  withShift: ':', withAltGr: '', withShiftAltGr: '' },
  Quote:        { vkey: 'VK_OEM_7',      value: '\'', withShift: '"', withAltGr: '', withShiftAltGr: '' },
  Backquote:    { vkey: 'VK_OEM_3',      value: '`',  withShift: '~', withAltGr: '', withShiftAltGr: '' },
  Comma:        { vkey: 'VK_OEM_COMMA',  value: ',',  withShift: '<', withAltGr: '', withShiftAltGr: '' },
  Period:       { vkey: 'VK_OEM_PERIOD', value: '.',  withShift: '>', withAltGr: '', withShiftAltGr: '' },
  Slash:        { vkey: 'VK_OEM_2',      value: '/',  withShift: '?', withAltGr: '', withShiftAltGr: '' },
  ...
]

Example output when using German (Swiss) keyboard layout (on Windows):

[
  ...
  Space:        { vkey: 'VK_SPACE',      value: ' ',  withShift: ' ', withAltGr: '',  withShiftAltGr: '' },
  Minus:        { vkey: 'VK_OEM_4',      value: '\'', withShift: '?', withAltGr: '´', withShiftAltGr: '' },
  Equal:        { vkey: 'VK_OEM_6',      value: '^',  withShift: '`', withAltGr: '~', withShiftAltGr: '' },
  BracketLeft:  { vkey: 'VK_OEM_1',      value: 'ü',  withShift: 'è', withAltGr: '[', withShiftAltGr: '' },
  BracketRight: { vkey: 'VK_OEM_3',      value: '¨',  withShift: '!', withAltGr: ']', withShiftAltGr: '' },
  Backslash:    { vkey: 'VK_OEM_8',      value: '$',  withShift: '£', withAltGr: '}', withShiftAltGr: '' },
  Semicolon:    { vkey: 'VK_OEM_7',      value: 'ö',  withShift: 'é', withAltGr: '',  withShiftAltGr: '' },
  Quote:        { vkey: 'VK_OEM_5',      value: 'ä',  withShift: 'à', withAltGr: '{', withShiftAltGr: '' },
  Backquote:    { vkey: 'VK_OEM_2',      value: '§',  withShift: '°', withAltGr: '',  withShiftAltGr: '' },
  Comma:        { vkey: 'VK_OEM_COMMA',  value: ',',  withShift: ';', withAltGr: '',  withShiftAltGr: '' },
  Period:       { vkey: 'VK_OEM_PERIOD', value: '.',  withShift: ':', withAltGr: '',  withShiftAltGr: '' },
  Slash:        { vkey: 'VK_OEM_MINUS',  value: '-',  withShift: '_', withAltGr: '',  withShiftAltGr: '' },
  ...
]

Supported OSes

  • linux (X11)
  • windows
  • mac
  • freebsd

Known issues

  • only tested from the Electron Main process

Developing

  • npm install -g node-gyp
  • node-gyp configure (for debugging use node-gyp configure -d)
  • node-gyp build
  • npm test (for debugging change index.js to load the node module from the Debug folder and press F5)

License

MIT

node-native-keymap's People

Contributors

aklyachkin avatar alexdima avatar chrmarti avatar deepak1556 avatar dimkr avatar djm00n avatar gebner avatar havogt avatar jrieken avatar landonepps avatar lszomoru avatar marshallofsound avatar maxgyver83 avatar poiru avatar rebornix avatar rzhao271 avatar tagattie avatar the-ress avatar tylerleonhardt avatar tyriar avatar wouterdemuynck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-native-keymap's Issues

Unable to Install on CentOS 8

sudo yum install libx11-devel.x86_64 libxkbfile-devel.x86_64 # or .i686

yum install fails. Any help would be appreciated. Thanks.

image

Error when building with node v18.20.x

command:

mkdir -p ~/projects/microsoft \
  && git clone https://github.com/microsoft/node-native-keymap.git \
    ~/projects/microsoft/node-native-keymap \
  && cd ~/projects/microsoft/node-native-keymap \
  && sudo npm install -g node-gyp \
  && node-gyp configure -d \
  && node-gyp build

output:

Cloning into '/home/jovyan/projects/microsoft/node-native-keymap'...
remote: Enumerating objects: 986, done.
remote: Counting objects: 100% (103/103), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 986 (delta 71), reused 85 (delta 63), pack-reused 883
Receiving objects: 100% (986/986), 279.75 KiB | 3.63 MiB/s, done.
Resolving deltas: 100% (584/584), done.

added 101 packages in 5s

14 packages are looking for funding
  run `npm fund` for details
npm notice 
npm notice New patch version of npm available! 10.5.0 -> 10.5.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.2
npm notice Run npm install -g [email protected] to update!
npm notice 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.12.3 found at "/usr/local/bin/python3"

gyp http GET https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/jovyan/projects/microsoft/node-native-keymap/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/jovyan/.cache/node-gyp/18.20.2/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/jovyan/.cache/node-gyp/18.20.2',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/jovyan/.cache/node-gyp/18.20.2/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/jovyan/projects/microsoft/node-native-keymap',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Debug', '-C', 'build' ]
make: Entering directory '/home/jovyan/projects/microsoft/node-native-keymap/build'
  CXX(target) Debug/obj.target/keymapping/src/string_conversion.o
  CXX(target) Debug/obj.target/keymapping/src/keymapping.o
In file included from ../src/keymapping.cc:10:
../src/keymapping.cc: In function ‘napi_value__* vscode_keyboard::OnDidChangeKeyboardLayoutImpl(napi_env, napi_callback_info)’:
../src/keymapping.cc:100:50: error: invalid conversion from ‘void (*)(napi_env, void*, void*)’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
  100 |                                                  FinalizeThreadsafeFunction, NULL, NotifyJS,
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  void (*)(napi_env, void*, void*) {aka void (*)(napi_env__*, void*, void*)}
../src/common.h:64:10: note: in definition of macro ‘NAPI_CALL_BASE’
   64 |     if ((the_call) != napi_ok) {                                         \
      |          ^~~~~~~~
../src/keymapping.cc:99:3: note: in expansion of macro ‘NAPI_CALL’
   99 |   NAPI_CALL(env, napi_create_threadsafe_function(env, func, NULL, resource_name, 0, 1, NULL,
      |   ^~~~~~~~~
In file included from /home/jovyan/.cache/node-gyp/18.20.2/include/node/node.h:79,
                 from ../src/keymapping.cc:6:
/home/jovyan/.cache/node-gyp/18.20.2/include/node/node_api.h:212:56: note:   initializing argument 8 of ‘napi_status napi_create_threadsafe_function(napi_env, napi_value, napi_value, napi_value, size_t, size_t, void*, node_api_nogc_finalize, void*, napi_threadsafe_function_call_js, napi_threadsafe_function__**)’
  212 |                                 node_api_nogc_finalize thread_finalize_cb,
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
make: *** [keymapping.target.mk:114: Debug/obj.target/keymapping/src/keymapping.o] Error 1
make: Leaving directory '/home/jovyan/projects/microsoft/node-native-keymap/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 6.1.0-20-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "build"
gyp ERR! cwd /home/jovyan/projects/microsoft/node-native-keymap
gyp ERR! node -v v18.20.2
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

Error when building on macOS 12

I'm getting an error when building on macOS 12.

$ node-gyp configure

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.8.2 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/baptiste/.nvm/versions/node/v18.16.0/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/baptiste/Development/Projects/github/node-native-keymap/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/baptiste/.nvm/versions/node/v18.16.0/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/baptiste/Library/Caches/node-gyp/18.16.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/baptiste/Library/Caches/node-gyp/18.16.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/baptiste/.nvm/versions/node/v18.16.0/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/baptiste/Library/Caches/node-gyp/18.16.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/baptiste/Development/Projects/github/node-native-keymap',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 

$ node-gyp build

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/keymapping/src/string_conversion.o
  CXX(target) Release/obj.target/keymapping/src/keymapping.o
  CXX(target) Release/obj.target/keymapping/src/keyboard_mac.o
In file included from ../src/keyboard_mac.mm:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
                                                         ~~~~~~~~~~~~~~                                                                       ^                  ~
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
        #define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
                                                      ^          ~
1 error generated.
make: *** [Release/obj.target/keymapping/src/keyboard_mac.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/baptiste/.nvm/versions/node/v18.16.0/lib/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/baptiste/.nvm/versions/node/v18.16.0/bin/node" "/Users/baptiste/.nvm/versions/node/v18.16.0/bin/node-gyp" "build"
gyp ERR! cwd /Users/baptiste/Development/Projects/github/node-native-keymap
gyp ERR! node -v v18.16.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok 

VSCode for Linux should rely on XKB keylabels, not rely on keycodes

The [Backspace] key and right Super or Ctrl key are best swapped. VSCode cannot do this.
The setkeycodes command cannot affect >1 keyboard and is reported to be ineffective on USB keyboards. As in microsoft/vscode#24690, keys are currently remapped in /usr/share/X11/xkb/keycodes/evdev, where keylabel assignments to X keycodes (Linux kernel keycodes + 8) can be effectively changed.

While some parts of VSCode—notably the settings editor—do respect these remappings, VSCode’s text editor is the only application that does not, at least not properly:

  • The physical right Control key keeps acting as ctrl instead of acting as Backspace;
  • The physical Backspace key keeps acting as Backspace, and additionally it acts as Control, that it is remapped to, resulting in deleteWordLeft.

VSCode key bindings are unable to fix all of this either, only able to change deleteWordLeft to deleteLeft.

Version: 1.44.2
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T17:50:03.709Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.13.0-36-generic

Steps to Reproduce:

  1. Open /usr/share/X11/xkb/keycodes/evdev
  2.  Replace:
    <BKSP> = 22;
    <RCTL> = 105;
    with:
    <RCTL> = 22; // was <BKSP>
    <BKSP> = 105; // was <RCTL>
  3. Log out, open new session;
  4. Check key behavior in Chrome;
  5. Check key behavior in VSCode.

Does this issue occur when all extensions are disabled?

Yes it is extensions agnostic.

Swapped keys (Backquote, IntlBackslash)

When using this library, Backquote and IntlBackslash keys are swapped. I can reproduce this with any keyboard layout. Am I doing something wrong?

Layout

{id: "com.apple.keylayout.German", localizedName: "German", lang: "de"}

Keymap

{
  // ...
  "Backquote": {
    "value": "<",
    "valueIsDeadKey": false,
    "withShift": ">",
    "withShiftIsDeadKey": false,
    "withAltGr": "≤",
    "withAltGrIsDeadKey": false,
    "withShiftAltGr": "≥",
    "withShiftAltGrIsDeadKey": false
  },
  "IntlBackslash": {
    "value": "^",
    "valueIsDeadKey": true,
    "withShift": "°",
    "withShiftIsDeadKey": false,
    "withAltGr": "„",
    "withAltGrIsDeadKey": false,
    "withShiftAltGr": "“",
    "withShiftAltGrIsDeadKey": false
  },
  // ...
}

My System

native-keymap v2.1.0, macOS Catalina, node v12.12.0

Can't build with electron

Hello, I can't build package when using native-keymap with electron, can some one help? Ty

0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\ch3rn1k\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Users\ch3rn1k\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:G:\Work\...\release\app\.npmrc Completed in 0ms
10 timing config:load:project Completed in 4ms
11 timing config:load:file:C:\Users\ch3rn1k\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\ch3rn1k\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm rebuild [email protected] [email protected] [email protected] [email protected]
23 verbose argv "rebuild" "[email protected]" "[email protected]" "[email protected]" "[email protected]"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\Users\ch3rn1k\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\ch3rn1k\AppData\Local\npm-cache\_logs\2022-10-07T17_40_37_656Z-debug-0.log
29 timing npm:load:logFile Completed in 5ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 21ms
33 timing arborist:ctor Completed in 0ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules/electron-active-window
37 timing build:queue Completed in 1ms
38 info run [email protected] preinstall node_modules/electron-active-window node setup.js
39 info run [email protected] preinstall { code: 0, signal: null }
40 timing build:run:preinstall:node_modules/electron-active-window Completed in 59ms
41 timing build:run:preinstall Completed in 60ms
42 info run [email protected] install node_modules/electron-active-window prebuild-install || node-gyp rebuild
43 info run [email protected] install node_modules/keysender node-gyp rebuild
44 info run [email protected] install node_modules/native-keymap node-gyp rebuild
45 info run [email protected] install node_modules/uiohook-napi node-gyp-build
46 info run [email protected] install { code: 0, signal: null }
47 timing build:run:install:node_modules/uiohook-napi Completed in 113ms
48 info run [email protected] install { code: 1, signal: null }
49 timing command:rebuild Completed in 3322ms
50 verbose stack Error: command failed
50 verbose stack     at ChildProcess.<anonymous> (C:\Users\ch3rn1k\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
50 verbose stack     at ChildProcess.emit (node:events:526:28)
50 verbose stack     at maybeClose (node:internal/child_process:1092:16)
50 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
51 verbose pkgid [email protected]
52 verbose cwd G:\Work\...\release\app
53 verbose Windows_NT 10.0.22000
54 verbose node v16.14.2
55 verbose npm  v8.16.0
56 error code 1
57 error path G:\Work\...\release\app\node_modules\native-keymap
58 error command failed
59 error command C:\WINDOWS\system32\cmd.exe /d /s /c C:\Users\ch3rn1k\AppData\Local\Temp\install-8356474c.cmd
60 error �믮������ ��᫥����⥫쭠� ᡮઠ �஥�⮢ � �⮬ �襭��. �⮡� ������� ��ࠫ������ ᡮ��, ������� ��ࠬ��� "/m".
60 error   string_conversion.cc
60 error   keymapping.cc
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-callbacks.h(221): error C2062: ⨯ "int" �� �ॡ���� [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-callbacks.h(335): error C2062: ⨯ "int" �� �ॡ���� [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-isolate.h(292): error C3646: legacy_oom_error_callback: ��������� ᯥ�䨪��� ��८�।������ [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-isolate.h(292): error C4430: ��������� ᯥ�䨪��� ⨯� - �।���������� int. �ਬ�砭��. C++ �� �����ন���� int �� 㬮�砭�� [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-isolate.h(1482): error C2061: ᨭ⠪��᪠� �訡��: �����䨪��� "LegacyOOMErrorCallback" [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-isolate.h(1545): error C2061: ᨭ⠪��᪠� �訡��: �����䨪��� "WasmDynamicTieringEnabledCallback" [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
60 error c:\users\ch3rn1k\.electron-gyp\20.1.3\include\node\v8-initialization.h(290): error C2061: ᨭ⠪��᪠� �訡��: �����䨪��� "LegacyOOMErrorCallback" [G:\Work\...\release\app\node_modules\native-keymap\build\keymapping.vcxproj]
61 error gyp info it worked if it ends with ok
61 error gyp info using [email protected]
61 error gyp info using [email protected] | win32 | x64
61 error gyp info find Python using Python version 3.10.7 found at "C:\Users\ch3rn1k\AppData\Local\Programs\Python\Python310\python.exe"
61 error gyp info find VS using VS2017 (15.9.28307.2094) found at:
61 error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
61 error gyp info find VS run with --verbose for detailed information
61 error gyp info spawn C:\Users\ch3rn1k\AppData\Local\Programs\Python\Python310\python.exe
61 error gyp info spawn args [
61 error gyp info spawn args   'G:\\Work\\...\\node_modules\\node-gyp\\gyp\\gyp_main.py',
61 error gyp info spawn args   'binding.gyp',
61 error gyp info spawn args   '-f',
61 error gyp info spawn args   'msvs',
61 error gyp info spawn args   '-I',
61 error gyp info spawn args   'G:\\Work\\...\\release\\app\\node_modules\\native-keymap\\build\\config.gypi',
61 error gyp info spawn args   '-I',
61 error gyp info spawn args   'G:\\Work\\...\\node_modules\\node-gyp\\addon.gypi',
61 error gyp info spawn args   '-I',
61 error gyp info spawn args   'C:\\Users\\ch3rn1k\\.electron-gyp\\20.1.3\\include\\node\\common.gypi',
61 error gyp info spawn args   '-Dlibrary=shared_library',
61 error gyp info spawn args   '-Dvisibility=default',
61 error gyp info spawn args   '-Dnode_root_dir=C:\\Users\\ch3rn1k\\.electron-gyp\\20.1.3',
61 error gyp info spawn args   '-Dnode_gyp_dir=G:\\Work\\...\\node_modules\\node-gyp',
61 error gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\ch3rn1k\\\\.electron-gyp\\\\20.1.3\\\\<(target_arch)\\\\node.lib',
61 error gyp info spawn args   '-Dmodule_root_dir=G:\\Work\\...\\release\\app\\node_modules\\native-keymap',
61 error gyp info spawn args   '-Dnode_engine=v8',
61 error gyp info spawn args   '--depth=.',
61 error gyp info spawn args   '--no-parallel',
61 error gyp info spawn args   '--generator-output',
61 error gyp info spawn args   'G:\\Work\\...\\release\\app\\node_modules\\native-keymap\\build',
61 error gyp info spawn args   '-Goutput_dir=.'
61 error gyp info spawn args ]
61 error gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
61 error gyp info spawn args [
61 error gyp info spawn args   'build/binding.sln',
61 error gyp info spawn args   '/clp:Verbosity=minimal',
61 error gyp info spawn args   '/nologo',
61 error gyp info spawn args   '/p:Configuration=Release;Platform=x64'
61 error gyp info spawn args ]
61 error gyp ERR! build error 
61 error gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
61 error gyp ERR! stack     at ChildProcess.onExit (G:\Work\...\node_modules\node-gyp\lib\build.js:203:23)
61 error gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
61 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
61 error gyp ERR! System Windows_NT 10.0.22000
61 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "G:\\Work\\...\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
61 error gyp ERR! cwd G:\Work\...\release\app\node_modules\native-keymap
61 error gyp ERR! node -v v16.14.2
61 error gyp ERR! node-gyp -v v9.2.0
61 error gyp ERR! not ok
62 verbose exit 1
63 timing npm Completed in 3431ms
64 verbose unfinished npm timer build 1665164437824
65 verbose unfinished npm timer build:deps 1665164437824
66 verbose unfinished npm timer build:run:install 1665164437885
67 verbose unfinished npm timer build:run:install:node_modules/electron-active-window 1665164437885
68 verbose unfinished npm timer build:run:install:node_modules/keysender 1665164437904
69 verbose unfinished npm timer build:run:install:node_modules/native-keymap 1665164437908
70 verbose code 1
71 error A complete log of this run can be found in:
71 error     C:\Users\ch3rn1k\AppData\Local\npm-cache\_logs\2022-10-07T17_40_37_656Z-debug-0.log

Failure to build native-keymap on Ubuntu 18.10 in WSL

Install Error

(base) balter@spectre:~$ npm -v
6.4.1
(base) balter@spectre:~$ node -v
v10.15.3
(base) balter@spectre:~$ npm install native-keymap

> [email protected] install /home/balter/node_modules/native-keymap
> node-gyp rebuild

make: Entering directory '/home/balter/node_modules/native-keymap/build'
  CXX(target) Release/obj.target/keymapping/src/string_conversion.o
  CXX(target) Release/obj.target/keymapping/src/keymapping.o
  CXX(target) Release/obj.target/keymapping/deps/chromium/x/keysym_to_unicode.o
../deps/chromium/x/keysym_to_unicode.cc:37:10: fatal error: X11/X.h: No such file or directory
 #include <X11/X.h>
          ^~~~~~~~~
compilation terminated.
make: *** [keymapping.target.mk:102: Release/obj.target/keymapping/deps/chromium/x/keysym_to_unicode.o] Error 1
make: Leaving directory '/home/balter/node_modules/native-keymap/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/balter/conda/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-18362-Microsoft
gyp ERR! command "/home/balter/conda/bin/node" "/home/balter/conda/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/balter/node_modules/native-keymap
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/balter/package.json'
npm WARN balter No description
npm WARN balter No repository field.
npm WARN balter No README data
npm WARN balter No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/balter/.npm/_logs/2019-10-04T23_55_06_066Z-debug.log

Log File

(base) balter@spectre:~$ cat /home/balter/.npm/_logs/2019-10-04T23_55_06_066Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/balter/conda/bin/node',
1 verbose cli   '/home/balter/conda/bin/npm',
1 verbose cli   'install',
1 verbose cli   'native-keymap' ]
2 info using [email protected]
3 info using [email protected]
4 verbose config Skipping project config: /home/balter/.npmrc. (matches userconfig)
5 verbose npm-session 85338fe7385eaaf5
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 http fetch GET 304 https://registry.npmjs.org/native-keymap 200ms (from cache)
9 silly pacote tag manifest for native-keymap@latest fetched in 234ms
10 timing stage:loadCurrentTree Completed in 567ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 11ms
16 silly install loadAllDepsIntoIdealTree
17 silly resolveWithNewModule [email protected] checking installable status
18 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 9ms
19 timing stage:loadIdealTree Completed in 23ms
20 silly currentTree balter
21 silly idealTree balter
21 silly idealTree └── [email protected]
22 silly install generateActionsToTake
23 timing stage:generateActionsToTake Completed in 5ms
24 silly diffTrees action count 1
25 silly diffTrees add [email protected]
26 silly decomposeActions action count 8
27 silly decomposeActions fetch [email protected]
28 silly decomposeActions extract [email protected]
29 silly decomposeActions preinstall [email protected]
30 silly decomposeActions build [email protected]
31 silly decomposeActions install [email protected]
32 silly decomposeActions postinstall [email protected]
33 silly decomposeActions finalize [email protected]
34 silly decomposeActions refresh-package-json [email protected]
35 silly install executeActions
36 silly doSerial global-install 8
37 verbose correctMkdir /home/balter/.npm/_locks correctMkdir not in flight; initializing
38 timing audit compress Completed in 2ms
39 info audit Submitting payload of 262bytes
40 verbose lock using /home/balter/.npm/_locks/staging-e454bf7fd738b289.lock for /home/balter/node_modules/.staging
41 silly doParallel extract 1
42 silly extract [email protected]
43 silly tarball trying native-keymap@latest by hash: sha512-KIlDZp0yKaHaGIkEVdlYN3QIaZICXwG1qh/oeBeQdM8TwAi90IAZlAD57qsNDkEvIJIzerCzb5jYYQAdHGBgYg==
44 silly extract native-keymap@latest extracted to /home/balter/node_modules/.staging/native-keymap-eedfffef (114ms)
45 timing action:extract Completed in 117ms
46 silly doReverseSerial unbuild 8
47 silly doSerial remove 8
48 silly doSerial move 8
49 silly doSerial finalize 8
50 silly finalize /home/balter/node_modules/native-keymap
51 timing action:finalize Completed in 22ms
52 silly doParallel refresh-package-json 1
53 silly refresh-package-json /home/balter/node_modules/native-keymap
54 timing action:refresh-package-json Completed in 19ms
55 silly doParallel preinstall 1
56 silly preinstall [email protected]
57 info lifecycle [email protected]~preinstall: [email protected]
58 timing action:preinstall Completed in 2ms
59 silly doSerial build 8
60 silly build [email protected]
61 info linkStuff [email protected]
62 silly linkStuff [email protected] has /home/balter/node_modules as its parent node_modules
63 timing action:build Completed in 1ms
64 silly doSerial global-link 8
65 silly doParallel update-linked 0
66 silly doSerial install 8
67 silly install [email protected]
68 info lifecycle [email protected]~install: [email protected]
69 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
70 verbose lifecycle [email protected]~install: PATH: /home/balter/conda/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/balter/node_modules/native-keymap/node_modules/.bin:/home/balter/node_modules/.bin:~/utilities/project-utilities:~/utilities/analysis-utilities:~/utilities/amd_templates/setup:/home/balter/conda/bin:/home/balter/conda/condabin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
71 verbose lifecycle [email protected]~install: CWD: /home/balter/node_modules/native-keymap
72 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
73 timing audit submit Completed in 346ms
74 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 350ms
75 timing audit body Completed in 6ms
76 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
77 info lifecycle [email protected]~install: Failed to exec install script
78 timing action:install Completed in 3651ms
79 verbose unlock done using /home/balter/.npm/_locks/staging-e454bf7fd738b289.lock for /home/balter/node_modules/.staging
80 timing stage:rollbackFailedOptional Completed in 31ms
81 timing stage:runTopLevelLifecycles Completed in 4572ms
82 silly saveTree balter
82 silly saveTree └── [email protected]
83 warn enoent ENOENT: no such file or directory, open '/home/balter/package.json'
84 verbose enoent This is related to npm not being able to find a file.
85 warn balter No description
86 warn balter No repository field.
87 warn balter No README data
88 warn balter No license field.
89 verbose stack Error: [email protected] install: `node-gyp rebuild`
89 verbose stack Exit status 1
89 verbose stack     at EventEmitter.<anonymous> (/home/balter/conda/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
89 verbose stack     at EventEmitter.emit (events.js:189:13)
89 verbose stack     at ChildProcess.<anonymous> (/home/balter/conda/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
89 verbose stack     at ChildProcess.emit (events.js:189:13)
89 verbose stack     at maybeClose (internal/child_process.js:970:16)
89 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
90 verbose pkgid [email protected]
91 verbose cwd /home/balter
92 verbose Linux 4.4.0-18362-Microsoft
93 verbose argv "/home/balter/conda/bin/node" "/home/balter/conda/bin/npm" "install" "native-keymap"
94 verbose node v10.15.3
95 verbose npm  v6.4.1
96 error code ELIFECYCLE
97 error errno 1
98 error [email protected] install: `node-gyp rebuild`
98 error Exit status 1
99 error Failed at the [email protected] install script.
99 error This is probably not a pr

Wayland support?

I was looking at whether I could get vscode running on wayland without xwayland (x11 support). It seems this library is required by vscode and uses X11 on linux. Could the linux code be ported to use something like xkbcommon (I'm not sure if this is the right replacement)? How hard do you think it'd be?

Unable to install varsion 2.4.1 on Ubuntu

Until version 2.4.0 everything was fine. Trying to install version 2.4.1 on Ubuntu produces this error:

In file included from ../src/keymapping.cc:10:
../src/keymapping.cc: In function ‘napi_value__* vscode_keyboard::Init(napi_env, napi_value)’:
../src/keymapping.cc:56:18: error: ‘napi_set_instance_data’ was not declared in this scope; did you mean ‘napi_new_instance’?
56 | NAPI_CALL(env, napi_set_instance_data(env, data, DeleteInstanceData, NULL));
| ^~~~~~~~~~~~~~~~~~~~~~
../src/common.h:64:10: note: in definition of macro ‘NAPI_CALL_BASE’
64 | if ((the_call) != napi_ok) {
| ^~~~~~~~
../src/keymapping.cc:56:3: note: in expansion of macro ‘NAPI_CALL’
56 | NAPI_CALL(env, napi_set_instance_data(env, data, DeleteInstanceData, NULL));
| ^~~~~~~~~

I tried with different NodeJS versions: 10.19.0, 10.20.0 and 12.4.1. I would appreciate any suggestions or fixes since this is a dependency of another package that I use. Thanks in advance!

BCP-47 for keyboard language on Windows

Thanks for this library, it makes cross platform keyboard stuff a lot easier.

I was wondering if it's possible to switch to CurrentInputMethodLanguageTag. It's a little painful to write the conversion from the hex identifiers.

Is there anything holding back from using this API? I'm not too familiar with the WinRT API's. Thanks!

Failure to build [email protected] on RHEL-7/x86_64

Hello, when trying to build vscode 1.10.2 on RHEL-7 (using spec file from https://github.com/FZUG/repo/blob/master/rpms/vscode/vscode.spec; 1.9.1 can be build without problems), I crash when building [email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/windows-foreground-love):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/windows-mutex):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-617.el7.sgruszka.x86_64
npm ERR! argv "/home/matej/build/EXTRAS/vscode/vscode-1.10.2/.nvm/versions/node/v6.10.1/bin/node" "/home/matej/build/EXTRAS/vscode/vscode-1.10.2/.nvm/versions/node/v6.10.1/bin/npm" "install" "--loglevel" "info"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the native-keymap package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs native-keymap
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls native-keymap
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/matej/build/EXTRAS/vscode/vscode-1.10.2/npm-debug.log
error: Bad exit status from /var/tmp/rpm-tmp.aiHLtp (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.aiHLtp (%build)

npm-debug.log.txt

Cannot build on Windows

I'm trying to build VS Code from source code, and every time I install the dependencies via yarn it always fails at building native-keymap:

error C:\Users\user\Sources\vscode\node_modules\native-keymap: Command failed.
Exit code: 7
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\user\Sources\vscode\node_modules\native-keymap
Output:
C:\Users\user\Sources\vscode\node_modules\native-keymap>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gy

p-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp http GET https://atom.io/download/electron/v4.2.10/node-v4.2.10-headers.tar.gz
gyp http 200 https://atom.io/download/electron/v4.2.10/node-v4.2.10-headers.tar.gz
gyp http GET https://atom.io/download/electron/v4.2.10/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v4.2.10/win-x86/node.lib
gyp http GET https://atom.io/download/electron/v4.2.10/win-x64/node.lib
gyp http 200 https://atom.io/download/electron/v4.2.10/win-x64/node.lib
gyp http 200 https://atom.io/download/electron/v4.2.10/win-x86/node.lib
gyp http 200 https://atom.io/download/electron/v4.2.10/SHASUMS256.txt
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\user\\Sources\\vscode\\node_modules\\native-keymap\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\user\\.node-gyp\\4.2.10\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\user\\.node-gyp\\4.2.10',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\user\\.node-gyp\\4.2.10\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\user\\Sources\\vscode\\node_modules\\native-keymap',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\user\\Sources\\vscode\\node_modules\\native-keymap\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack     at _errnoException (util.js:1022:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:372:16)
gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebu

ild"
gyp ERR! cwd C:\Users\user\Sources\vscode\node_modules\native-keymap
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2

I have both Visual Studio 2017 and 2019 installed, and also the C++ compilers and build tools (including MSBuild).

Fix build on FreeBSD 12

The following error was generated when I tried to build a native node module on FreeBSD 12.

In file included from ../src/keyboard_x.cc:6:
../src/keymapping.h:40:3: error: unknown type name 'pthread_t'; did you mean 'pthread'?
  pthread_t tid;
  ^~~~~~~~~
  pthread
/usr/include/stdio.h:157:9: note: 'pthread' declared here
        struct pthread *_fl_owner;      /* current owner */
               ^
In file included from ../src/keyboard_x.cc:6:
../src/keymapping.h:40:13: error: field has incomplete type 'pthread'
  pthread_t tid;
            ^
/usr/include/stdio.h:157:9: note: forward declaration of 'pthread'
        struct pthread *_fl_owner;      /* current owner */
               ^
2 errors generated.

Simply adding the line:

#include <pthread.h>

in keymapping.h solves the build issue.

Could you review if the change is OK?

Best regards,
Hiroki

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.