Giter VIP home page Giter VIP logo

keyboard-layout's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

keyboard-layout

CI

Read and observe the current keyboard layout.

To get the current keyboard layout, call getCurrentKeyboardLayout. It returns the string identifier of the current layout based on the value returned by the operating system.

const KeyboardLayout = require('keyboard-layout')
KeyboardLayout.getCurrentKeyboardLayout() // => "com.apple.keylayout.Dvorak"

If you want to watch for layout changes, use onDidChangeCurrentKeyboardLayout or observeCurrentKeyboardLayout. They work the same, except observeCurrentKeyboardLayout invokes the given callback immediately with the current layout value and then again next time it changes, whereas onDidChangeCurrentKeyboardLayout only invokes the callback on the next change.

const KeyboardLayout = require('keyboard-layout')
subscription = KeyboardLayout.observeCurrentKeyboardLayout((layout) => console.log(layout))
subscription.dispose() // to unsubscribe later

To return characters for various modifier states based on a DOM 3 KeyboardEvent.code value and the current system keyboard layout, use getCurrentKeymap():

const KeyboardLayout = require('keyboard-layout')
KeyboardLayout.getCurrentKeymap()['KeyS']
/*
On a US layout, this returns:
{
  unmodified: 's',
  withShift: 'S',
  withAltGraph: 'ß',
  withShiftAltGraph: 'Í'
}
*/

keyboard-layout's People

Contributors

50wliu avatar anaisbetts avatar ben3eee avatar charliehess avatar cifratila avatar damieng avatar darangi avatar daviwil avatar felixrieseberg avatar itachisan avatar kevinsawicki avatar marshallofsound avatar maxbrunsfeld avatar mnquintana avatar nornagon avatar pizzamig avatar rafeca avatar sadick254 avatar smashwilson avatar torn4dom4n avatar zcbenz 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

Watchers

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

keyboard-layout's Issues

Build fails on Raspberry Pi

I'm trying to build Atom on a Raspberry Pi 2, and running npm install fails with this message:

> [email protected] install /media/Raspberry Pi Documents/atom-arm/atom/node_modules/keyboard-layout
> node-gyp rebuild

make: Entering directory '/media/Raspberry Pi Documents/atom-arm/atom/node_modules/keyboard-layout/build'
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
In file included from ../../nan/nan.h:51:0,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pi/.node-gyp/9.4.0/include/node/node.h:220:11: error: looser throw specifier for ‘virtual node::MultiIsolatePlatform::~MultiIsolatePlatform()’
In file included from /home/pi/.node-gyp/9.4.0/include/node/node.h:64:0,
                 from ../../nan/nan.h:51,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pi/.node-gyp/9.4.0/include/node/v8-platform.h:178:11: error:   overriding ‘virtual v8::Platform::~Platform() noexcept (true)’
keyboard-layout-manager.target.mk:95: recipe for target 'Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o' failed
make: *** [Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Error 1
make: Leaving directory '/media/Raspberry Pi Documents/atom-arm/atom/node_modules/keyboard-layout/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/media/Raspberry Pi Documents/.nvm/versions/node/v9.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.1.19-v7+
gyp ERR! command "/media/Raspberry Pi Documents/.nvm/versions/node/v9.4.0/bin/node" "/media/Raspberry Pi Documents/.nvm/versions/node/v9.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /media/Raspberry Pi Documents/atom-arm/atom/node_modules/keyboard-layout
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
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/pi/.npm/_logs/2018-01-28T18_21_01_598Z-debug.log

Is there any way to fix this error?

Not able to update

Prerequisites

Description

Steps to Reproduce

Expected behavior:

Actual behavior:

Reproduces how often:

Versions

Additional Information

Is it possible to expose interface to enumerate all installed keyboard layout?

Hi,

keyboard-layout currently exposes getInstalledKeyboardLanguages() to enumerate languages of keyboard currently installed - is it possible to expose to enumerate all installed keyboard layout as well (for available platforms)? at least win32 seems calling GetKeyboardLayoutList internally to compose keyboard language list.

Spanish Keyboard: `BracketLeft` is not populated in keymap

Hi there,

First off, thank you for this library! It was tremendously helpful in adding intl keyboard support for my project.

It's worked great in general, but I'm seeing a strange issue on Windows 10 with the Spanish keyboard (es-ES).

When I call getCurrentKeymap, it seems to be missing the BracketLeft key in this case:
image

This reproduces in both Electron (v1.7.7) and Node (v.7.2.1).

A minimal repro is as follows:

  • Create a new folder
  • Run npm install keyboard-layout
  • Run node for the node CLI
  • Run require("keyboard-layout").getCurrentKeymap()["BracketLeft"]

Expected: Should see an entry for this key binding.
Actual: No entry is shown, but BracketRight has a key map entry:

image

Thanks for your help.

Wrong keyboard language

Description

This is an issue with the library and not Atom. getCurrentKeyboardLanguage returns the OS language on Windows (10) instead the keyboard language.

Steps to Reproduce

Let's say your OS language is Germany and using a German keyboard layout. getCurrentKeyboardLanguage() will report de-DE as keyboard language but if you switch to another keyboard layout the reported keyboard language is still de-DE.

Expected behavior:

Keyboard language should match the language of the selected keyboard layout.

Actual behavior:

German OS language + German keyboard layout:

  • Layout: 00000407
  • Language: de-DE

German OS language + France keyboard layout:

  • Layout: 0000040C (France)
  • Language: de-DE

Reproduces how often:

Always

Versions

keyboard-layout v2.0.16

Build error when trying to build latest Atom code

Hi, I pulled the latest Atom code and keep getting this build error on both my work laptop and home desktop for Windows 7 x64. I normally have been able to build Atom just fine until the last week or so. I am in the process of looking at keyboard-layout, but I'm a bit stumped ;). Here is the full output I get (I get the same output with script/build):

$ script/bootstrap
Node: v0.10.31
npm: v1.4.28
Python: v2.7.8
Installing build modules...
Installing apm...
Installing modules failed
> [email protected] preinstall c:\dev\git\atom
> node -e 'process.exit(0)'


> [email protected] install c:\dev\git\atom\node_modules\atom-keymap\node_modules\keyboard-layou
t
> node-gyp rebuild

Building the projects in this solution one at a time. To enable parallel build, please add the "/m"
switch.
  keyboard-layout-observer-windows.cc
..\src\keyboard-layout-observer-windows.cc(44): error C2220: warning treated as error - no 'object'
file generated [c:\dev\git\atom\node_modules\atom-keymap\node_modules\keyboard-layout\build\keyboard
-layout-observer.vcxproj]
..\src\keyboard-layout-observer-windows.cc(44): warning C4344: behavior change: use of explicit temp
late arguments results in call to 'v8::Local<T> NanNew<v8::String,char*>(char *)' [c:\dev\git\atom\n
ode_modules\atom-keymap\node_modules\keyboard-layout\build\keyboard-layout-observer.vcxproj]
          with
          [
              T=v8::String
          ]
          but the regular function 'v8::Local<T> NanNew(const char *,int)' is a better match
          with
          [
              T=v8::String
          ]
          if you expect 'v8::Local<T> NanNew(const char *,int)' to be called then you need to make i
t an explicit specialization
          with
          [
              T=v8::String
          ]

npm WARN engine [email protected]: wanted: {"node":"~0.8.x"} (current: {"node":"v0.10.35","npm":"1.4
.4"})
gypnpm 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 most likely a problem with the keyboard-layout 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 their info via:
npm ERR!     npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\dev\\git\\atom\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "c:\
\dev\\git\\atom\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--glo
balconfig" "c:\\dev\\git\\atom\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\
\Users\\Adam Boesch\\.atom\\.apmrc" "install" "--target=0.20.0" "--arch=ia32" "--quiet" "--msvs_vers
ion=2010"
npm ERR! cwd c:\dev\git\atom
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm

AddEnvironmentCleanupHook not supported in Node v10.1.0

Prerequisites

Description

Are we sure that AddEnvironmentCleanupHook is included in all versions of Node 10? I tried a rebuild using Node 10.1.0 and got:

> [email protected] install /Users/charlie/dnd-observer
> node-gyp rebuild

  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager.o
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-mac.o
../src/keyboard-layout-manager-mac.mm:47:9: error: no member named 'AddEnvironmentCleanupHook' in
      namespace 'node'
  node::AddEnvironmentCleanupHook(
  ~~~~~~^
../src/keyboard-layout-manager-mac.mm:56:9: error: no member named 'RemoveEnvironmentCleanupHook'
      in namespace 'node'
  node::RemoveEnvironmentCleanupHook(
  ~~~~~~^
2 errors generated.

Upgrading to Node LTS fixed the issue.

Comment shortcut does not work with Mac's Dvorak - Qwerty ⌘ mode

This is a repost. I figured this might be a better place for my issue.

Originally posted in atom-keymap: atom/atom-keymap#60

I use Mac's Dvorak - Qwerty ⌘ mode for my keyboard layout. Recently, Atom gained full support for this keyboard layout (yay!), but I found one shortcut not working...

When I try to comment something out in a CSS or JS file by using the + / shortcut, nothing happens. All other shortcuts that I use work, including copy, paste, command palette, find, etc. All of them use the ⌘ key and they work.

I tried to disable my 3rd party packages, but it still didn't work.

I checked my keybindings, and commenting is indeed set to + /.

I have no custom keybindings.

Changing my keyboard layout to US allows me to use the shortcut, so I know is has something to do with the Dvorak - Qwerty ⌘ mode.

Yosemite 10.10
Atom 0.145.0

strlen crash

Saw this crash while pairing with @8-uh, seemed to occur at startup.

Didn't happen consistently, I don't think any non-standard keyboard layout was being used.

Doing a bit of googling seems to suggest that the kTISPropertyInputSourceID may return NULL.

Process:               Atom Helper [91256]
Path:                  /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper
Identifier:            com.github.atom.helper
Version:               1.15.0 (1.15.0)
Code Type:             X86-64 (Native)
Parent Process:        Atom [91201]
Responsible:           Atom [91201]
User ID:               501
Date/Time:             2017-04-06 13:20:20.631 -0500
OS Version:            Mac OS X 10.12.3 (16D32)
Report Version:        12
Anonymous UUID:        9DB2C149-B0C2-EAC7-F4DD-3D029E5B71AB
Sleep/Wake UUID:       645CF1A8-67BE-492D-8867-62BCF5C1C314
Time Awake Since Boot: 59000 seconds
Time Since Wake:       3300 seconds
System Integrity Protection: disabled
Crashed Thread:        0  CrRendererMain  Dispatch queue: com.apple.main-thread
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
--> 
    __TEXT                 0000000104e34000-0000000104e35000 [    4K] r-x/rwx SM=COW  /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper
Thread 0 Crashed:: CrRendererMain  Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib               0x00007fffbc0d1b52 strlen + 18
1   libnode.dylib                   0x0000000108f2785c v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) + 156
2   keyboard-layout-manager.node    0x000000010e425462 KeyboardLayoutManager::GetCurrentKeyboardLayout(Nan::FunctionCallbackInfo<v8::Value> const&) + 102
3   keyboard-layout-manager.node    0x000000010e425f8b Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&) + 141
4   libnode.dylib                   0x0000000108f3e09a v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) + 298
5   libnode.dylib                   0x0000000108f77ae5 0x108b94000 + 4078309
6   libnode.dylib                   0x0000000108f7994e 0x108b94000 + 4086094
7   ???                             0x000034d516a08ba7 0 + 58089812298663
8   ???                             0x000034d517e431bb 0 + 58089833509307
9   ???                             0x000034d517e427a2 0 + 58089833506722
10  ???                             0x000034d517e41939 0 + 58089833503033
11  ???                             0x000034d517e3fd8c 0 + 58089833495948
12  ???                             0x000034d516a08db5 0 + 58089812299189
13  ???                             0x000034d517e3fa8d 0 + 58089833495181
14  ???                             0x000034d517e3f949 0 + 58089833494857
15  ???                             0x000034d516a08db5 0 + 58089812299189
16  ???                             0x000034d516a45fa3 0 + 58089812549539
17  ???                             0x000034d516a29f0f 0 + 58089812434703
18  libnode.dylib                   0x0000000109251b5b 0x108b94000 + 7068507
19  libnode.dylib                   0x000000010925195b v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 331
20  libnode.dylib                   0x0000000108f24a77 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 535

mac: does not run on M1 processor

I use this component within an electron app. When I run the application on a Mac with the M1 processor, I get this exception on startup:

App threw an error during load
Error: dlopen(/Users/ume/git/monorepo/web/electron/app-helium/node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node, 0x0001): tried: '/Users/ume/git/monorepo/web/electron/app-helium/node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1800)
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18)
at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1800)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:829:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/ume/git/monorepo/web/electron/app-helium/node_modules/keyboard-layout/lib/keyboard-layout.js:4:35)
at Module._compile (node:internal/modules/cjs/loader:1116:14)

When I run the same app compiled as x86-64, I don't get any exception.

Building for Linux 32 bits

Hello there,

I'm trying to build an Electron app for Linux 32 bits and I get this errors:

Error: /home/travis/.nvm/versions/node/v9.11.2/bin/node exited with code 1
Error output:
../HashSetWrap.cpp:61:37: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
    args.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                    ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8.h:3749:3: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8config.h:332:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
1 warning generated.
../addon.cc:23:6: warning: unused function 'InitAll' [-Wunused-function]
void InitAll(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
     ^
1 warning generated.
../ad_block_client_wrap.cc:170:37: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
    args.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                    ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8.h:3749:3: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8config.h:332:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
1 warning generated.
../src/Failure.cpp:47:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete stage;
        ^
              []
../src/Failure.cpp:33:16: note: allocated with 'new[]' here
        char *stage = new char [strlen (part1)
                      ^
1 warning generated.
../src/SimpleString.cpp:33:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete buffer;
        ^
              []
../src/SimpleString.cpp:12:10: note: allocated with 'new[]' here
: buffer(new char [1])
         ^
../src/SimpleString.cpp:19:11: note: allocated with 'new[]' here
: buffer (new char [strlen (otherBuffer) + 1])
          ^
1 warning generated.
../HashSetWrap.cpp:61:37: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
    args.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                    ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8.h:3749:3: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/home/travis/.electron-gyp/iojs-1.8.7/deps/v8/include/v8config.h:332:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
1 warning generated.
../vendor/hunspell/src/google/bdict_reader.cc:670:15: warning: unused variable 'begin' [-Wunused-variable]
  const char* begin = reinterpret_cast<const char*>(&bdict_data_[cur_offset_]);
              ^
1 warning generated.
In file included from ../vendor/hunspell/src/hunspell/affentry.cxx:9:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                      ~ ^~~~
                                                                                                        0
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                               ~ ^~~~
                                                                                                                 0
../vendor/hunspell/src/hunspell/affentry.cxx:546:57: warning: while loop has empty body [-Wempty-body]
                        while (p && *p != ']' && ((p = nextchar(p)) != NULL));
                                                                             ^
../vendor/hunspell/src/hunspell/affentry.cxx:546:57: note: put the semicolon on a separate line to silence this warning
3 warnings generated.
In file included from ../vendor/hunspell/src/hunspell/affixmgr.cxx:12:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                      ~ ^~~~
                                                                                                        0
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                               ~ ^~~~
                                                                                                                 0
2 warnings generated.
In file included from ../vendor/hunspell/src/hunspell/hashmgr.cxx:9:
../vendor/hunspell/src/hunspell/hashmgr.hxx:32:21: warning: private field 'userword' is not used [-Wunused-private-field]
  int               userword;
                    ^
1 warning generated.
/usr/bin/ld: cannot find -lxkbfile
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/obj.target/keyboard-layout-manager.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/travis/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.13.0-1017-gcp
gyp ERR! command "/home/travis/.nvm/versions/node/v9.11.2/bin/node" "/home/travis/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/keyboard-layout
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
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/travis/.npm/_logs/2018-06-18T16_57_17_616Z-debug.log
    at ChildProcess.childProcess.once.code (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (events.js:272:13)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:180:13)
    at Pipe._handle.close [as _onclose] (net.js:541:12)
From previous event:
    at rebuild (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/out/util/yarn.js:234:18)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/util/yarn.ts:20:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
From previous event:
    at installOrRebuild (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/out/util/yarn.js:68:17)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:451:13
    at Generator.next (<anonymous>)
From previous event:
    at Packager.installAppDependencies (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:415:70)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:365:20
From previous event:
    at Packager.doBuild (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:341:39)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:317:52
From previous event:
    at Packager._build (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:294:133)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:290:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
From previous event:
    at Packager.build (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/packager.ts:248:14)
    at /home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/home/travis/build/saenzramiro/electron-travis-test/desktop/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>

For 64 bits works ok. Am I doing something wrong?

macOS: CMD+backtick does not work in editor

@fchoquet commented on Apr 27, 2018, 7:32 AM UTC:

Prerequisites

Description

On mac we can normally use CMD+backtick to switch between open windows of the same application.
In Atom it works fine from the menu or project pane, but not from the editor. It actually inserts a backtick, which is not the intended behavior.

Steps to Reproduce

  1. Open 2 Atom projects in 2 windows
  2. In project 1, click into the editor. You should see the cursor blinking and be able to type text
  3. Use the CMD+backtick key combination

Expected behavior: Activate the project 2 window

Actual behavior: A backtick is inserted in the editor.

Reproduces how often: 100%

Versions

Atom : 1.26.0
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0

apm 1.19.0
npm 3.10.10
node 6.9.5 x64
atom 1.26.0
python 2.7.10
git 2.15.1

OS: macOS 10.13.4

French keyboard layout

Additional Information

Looks like it's similar to this issue #11531 but in my case the key binding works from any pane or menu except the editor.

This issue was moved by rsese from atom/atom/issues/17227.

Fails to build on Windows: `error C2220: warning treated as error - no 'object' file generated`

Windows 10
Visual Studio 2015
MSBuild 14

error C2220: warning treated as error - no 'object' file generated

PS C:\Code\N1> npm install keyboard-layout

> [email protected] install C:\Code\N1\node_modules\keyboard-layout
> node-gyp rebuild


C:\Code\N1\node_modules\keyboard-layout>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  keyboard-layout-observer-windows.cc
..\src\keyboard-layout-observer-windows.cc(92): error C2220: warning treated as error - no 'object' file generated [C:\Code\N1\node_modules\k
eyboard-layout\build\keyboard-layout-observer.vcxproj]
..\src\keyboard-layout-observer-windows.cc(92): warning C4311: 'type cast': pointer truncation from 'HKL' to 'UINT' [C:\Code\N1\node_modules\
keyboard-layout\build\keyboard-layout-observer.vcxproj]
..\src\keyboard-layout-observer-windows.cc(92): warning C4302: 'type cast': truncation from 'HKL' to 'UINT' [C:\Code\N1\node_modules\keyboard
-layout\build\keyboard-layout-observer.vcxproj]
..\src\keyboard-layout-observer-windows.cc(111): warning C4311: 'type cast': pointer truncation from 'HKL' to 'UINT' [C:\Code\N1\node_modules
\keyboard-layout\build\keyboard-layout-observer.vcxproj]
..\src\keyboard-layout-observer-windows.cc(111): warning C4302: 'type cast': truncation from 'HKL' to 'UINT' [C:\Code\N1\node_modules\keyboar
d-layout\build\keyboard-layout-observer.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Code\N1\node_modules\keyboard-layout
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "keyboard-layout"
npm ERR! node v4.2.1
npm ERR! npm  v3.3.8
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! This is most likely a problem with the keyboard-layout 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 their info via:
npm ERR!     npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Code\N1\npm-debug.log

install fails at node-gyp rebuild [windows+Linux]

The latest version 2.0.10 fails to install on linux and windows although it works pretty well on macOs. I'm using it in electron-spellchecker.

➜  electron-spellchecker git:(master) npm install

> [email protected] install /home/akash/dev/electron-spellchecker/node_modules/keyboard-layout
> node-gyp rebuild

make: Entering directory '/home/akash/dev/electron-spellchecker/node_modules/keyboard-layout/build'
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
In file included from ../src/keyboard-layout-manager-linux.cc:1:0:
../src/keyboard-layout-manager.h:7:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
keyboard-layout-manager.target.mk:96: recipe for target 'Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o' failed
make: *** [Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Error 1
make: Leaving directory '/home/akash/dev/electron-spellchecker/node_modules/keyboard-layout/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/akash/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-53-generic
gyp ERR! command "/home/akash/.nvm/versions/node/v6.9.4/bin/node" "/home/akash/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/akash/dev/electron-spellchecker/node_modules/keyboard-layout
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/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 ERR! Linux 4.4.0-53-generic
npm ERR! argv "/home/akash/.nvm/versions/node/v6.9.4/bin/node" "/home/akash/.nvm/versions/node/v6.9.4/bin/npm" "install"
npm ERR! node v6.9.4
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 keyboard-layout 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 keyboard-layout
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/akash/dev/electron-spellchecker/npm-debug.log

UPDATE - installing following dev package fixed this issue on Linux.

sudo apt-get install libxext-dev libxtst-dev libxkbfile-dev

not getting any keyboard updates on linux

Prerequisites

Description

this is my code, from your example, when i run the script it only triggers once and then exits. Also tried to use it in my project, but it does not receive updates

const KeyboardLayout = require('keyboard-layout')
KeyboardLayout.observeCurrentKeyboardLayout((layout) => console.log(layout))

P.S im not sure about atom, i dont even know what is that, all that links seem irrelevant

Steps to Reproduce

  1. run the example
  2. not updates and exits
  3. try it in my project
  4. debug
  5. still no updates

Expected behavior:

it should update everytime i press alt+shift

Actual behavior:

no updates

Reproduces how often:

always

Versions

not sure here, installed from npm and have no atom

Additional Information

OS: Arch Linux KDE

Atom

Prerequisites

Description

Steps to Reproduce

Expected behavior:

Actual behavior:

Reproduces how often:

Versions

Additional Information

Failed to build with node v12.1.0

When I initialize a fresh project and try to add keyboard-layout the build with node-gyp fails.
I use node v12.1.0, yarn und 64bit Linux

Here's the output

yarn add electron-spellchecker
yarn add v1.13.0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/3] ⢀ @nornagon/cld
[2/3] ⢀ @nornagon/spellchecker
error /home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/home/pk/.nvm/versions/node/v12.1.0/lib/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   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pk/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/pk/.node-gyp/12.1.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=/home/pk/.node-gyp/12.1.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/pk/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/pk/.node-gyp/12.1.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Verzeichnis „/home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout/build“ wird betreten
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In Funktion »void Nan::AsyncQueueWorker(Nan::AsyncWorker*)«:
../../nan/nan.h:2232:62: Warnung: Umwandlung zwischen inkompatiblen Funktionstypen von »void (*)(uv_work_t*)« {aka »void (*)(uv_work_s*)«} nach »uv_after_work_cb« {aka »void (*)(uv_work_s*, int)«} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../src/keyboard-layout-manager-linux.cc: In statischer Elementfunktion »static void KeyboardLayoutManager::Init(v8::Local<v8::Object>, v8::Local<v8::Object>)«:
../src/keyboard-layout-manager-linux.cc:19:78: Fehler: keine passende Funktion für Aufruf von »v8::FunctionTemplate::GetFunction()«
   module->Set(Nan::New("exports").ToLocalChecked(), newTemplate->GetFunction());
                                                                              ^
In file included from /home/pk/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pk/.node-gyp/12.1.0/include/node/v8.h:5947:46: Anmerkung: candidate: »v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)«
   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                              ^~~~~~~~~~~
/home/pk/.node-gyp/12.1.0/include/node/v8.h:5947:46: Anmerkung:   Kandidat erwartet 1 Argument, 0 angegeben
In file included from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../src/keyboard-layout-manager-linux.cc: Im globalen Gültigkeitsbereich:
/home/pk/.node-gyp/12.1.0/include/node/node.h:556:43: Warnung: Umwandlung zwischen inkompatiblen Funktionstypen von »void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)« nach »node::addon_register_func« {aka »void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)«} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/pk/.node-gyp/12.1.0/include/node/node.h:590:3: Anmerkung: bei Substitution des Makros »NODE_MODULE_X«
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/keyboard-layout-manager-linux.cc:22:1: Anmerkung: bei Substitution des Makros »NODE_MODULE«
 NODE_MODULE(keyboard_layout_manager, KeyboardLayoutManager::Init)
 ^~~~~~~~~~~
../src/keyboard-layout-manager-linux.cc: In statischer Elementfunktion »static Nan::NAN_METHOD_RETURN_TYPE KeyboardLayoutManager::GetCurrentKeymap(Nan::NAN_METHOD_ARGS_TYPE)«:
../src/keyboard-layout-manager-linux.cc:195:45: Warnung: »bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)« ist veraltet: Use maybe version [-Wdeprecated-declarations]
         entry->Set(unmodifiedKey, unmodified);
                                             ^
In file included from /home/pk/.node-gyp/12.1.0/include/node/v8-internal.h:14,
                 from /home/pk/.node-gyp/12.1.0/include/node/v8.h:25,
                 from /home/pk/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pk/.node-gyp/12.1.0/include/node/v8.h:3359:26: Anmerkung: hier deklariert
                     bool Set(Local<Value> key, Local<Value> value));
                          ^~~
/home/pk/.node-gyp/12.1.0/include/node/v8config.h:322:3: Anmerkung: in Definition des Makros »V8_DEPRECATE_SOON«
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/keyboard-layout-manager-linux.cc:196:43: Warnung: »bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)« ist veraltet: Use maybe version [-Wdeprecated-declarations]
         entry->Set(withShiftKey, withShift);
                                           ^
In file included from /home/pk/.node-gyp/12.1.0/include/node/v8-internal.h:14,
                 from /home/pk/.node-gyp/12.1.0/include/node/v8.h:25,
                 from /home/pk/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pk/.node-gyp/12.1.0/include/node/v8.h:3359:26: Anmerkung: hier deklariert
                     bool Set(Local<Value> key, Local<Value> value));
                          ^~~
/home/pk/.node-gyp/12.1.0/include/node/v8config.h:322:3: Anmerkung: in Definition des Makros »V8_DEPRECATE_SOON«
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/keyboard-layout-manager-linux.cc:197:39: Warnung: »bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)« ist veraltet: Use maybe version [-Wdeprecated-declarations]
         result->Set(dom3CodeKey, entry);
                                       ^
In file included from /home/pk/.node-gyp/12.1.0/include/node/v8-internal.h:14,
                 from /home/pk/.node-gyp/12.1.0/include/node/v8.h:25,
                 from /home/pk/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pk/.node-gyp/12.1.0/include/node/v8.h:3359:26: Anmerkung: hier deklariert
                     bool Set(Local<Value> key, Local<Value> value));
                          ^~~
/home/pk/.node-gyp/12.1.0/include/node/v8config.h:322:3: Anmerkung: in Definition des Makros »V8_DEPRECATE_SOON«
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from /home/pk/.node-gyp/12.1.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/pk/.node-gyp/12.1.0/include/node/v8.h: In Instanziierung von »void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]«:
/home/pk/.node-gyp/12.1.0/include/node/node_object_wrap.h:84:78:   von hier erfordert
/home/pk/.node-gyp/12.1.0/include/node/v8.h:9817:16: Warnung: Umwandlung zwischen inkompatiblen Funktionstypen von »v8::WeakCallbackInfo<node::ObjectWrap>::Callback« {aka »void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)«} nach »Callback« {aka »void (*)(const v8::WeakCallbackInfo<void>&)«} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pk/.node-gyp/12.1.0/include/node/v8.h: In Instanziierung von »void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]«:
../../nan/nan_object_wrap.h:65:61:   von hier erfordert
/home/pk/.node-gyp/12.1.0/include/node/v8.h:9817:16: Warnung: Umwandlung zwischen inkompatiblen Funktionstypen von »v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback« {aka »void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)«} nach »Callback« {aka »void (*)(const v8::WeakCallbackInfo<void>&)«} [-Wcast-function-type]
make: *** [keyboard-layout-manager.target.mk:109: Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Fehler 1
make: Verzeichnis „/home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout/build“ wird verlassen
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/pk/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Linux 5.0.9-2-MANJARO
gyp ERR! command "/home/pk/.nvm/versions/node/v12.1.0/bin/node" "/home/pk/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pk/Downloads/spellcheckertest/node_modules/keyboard-layout
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0

Occasionally crashes on Electron 16

Prerequisites

I'm using this module in my app.

Description

The renderer process crashes occasionally with the following stacktrace in the main process:

node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper (Renderer).app/Contents/MacOS/Electron Helper (Renderer)[8617]: ../../third_party/electron_node/src/api/callback.cc:272:MaybeLocal<v8::Value> node::MakeCallback(v8::Isolate *, Local<v8::Object>, Local<v8::Function>, int, Local<v8::Value> *, node::async_context): Assertion `(env) != nullptr' failed.
 1: 0x1161d8855 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x1161d862f node::FatalException(v8::Isolate*, v8::TryCatch const&) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x1161305af node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x1047f5ea5 Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*, Nan::AsyncResource*) const [/path/to/app/node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node]
 5: 0x1047f4dca KeyboardLayoutManager::HandleKeyboardLayoutChanged() [/path/to/app/node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node]
 6: 0x10f3edc82 uv_async_send [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x10f3ff81b uv_free_interface_addresses [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x10f3ee09f uv_run [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x10f5676a3 ElectronInitializeICUandStartNode [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x1125c42db _TIFFSwab64BitData [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x1125deda3 _TIFFSwab64BitData [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x112621421 base::mac::CxxPersonalityRoutine(int, _Unwind_Action, unsigned long long, _Unwind_Exception*, _Unwind_Context*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x112620582 base::mac::CxxPersonalityRoutine(int, _Unwind_Action, unsigned long long, _Unwind_Exception*, _Unwind_Context*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x112620b4f base::mac::CxxPersonalityRoutine(int, _Unwind_Action, unsigned long long, _Unwind_Exception*, _Unwind_Context*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
15: 0x7ff81e79184d __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
16: 0x7ff81e7917b5 __CFRunLoopDoSource0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
17: 0x7ff81e791534 __CFRunLoopDoSources0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
18: 0x7ff81e78ff6b __CFRunLoopRun [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
19: 0x7ff81e78f52d CFRunLoopRunSpecific [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
20: 0x7ff81f5f775e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] [/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation]
21: 0x112621c19 base::mac::CxxPersonalityRoutine(int, _Unwind_Action, unsigned long long, _Unwind_Exception*, _Unwind_Context*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
22: 0x1126205f2 base::mac::CxxPersonalityRoutine(int, _Unwind_Action, unsigned long long, _Unwind_Exception*, _Unwind_Context*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
23: 0x1125e030a _TIFFSwab64BitData [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
24: 0x1125aa221 _TIFFSwab64BitData [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
25: 0x115f42d6f device::MapperSwitchPro(device::Gamepad const&, device::Gamepad*) [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
26: 0x1104bc08d cdef_copy_rect8_16bit_to_16bit_sse4_1 [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
27: 0x1104baa8b cdef_copy_rect8_16bit_to_16bit_sse4_1 [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
28: 0x1104bb389 cdef_copy_rect8_16bit_to_16bit_sse4_1 [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
29: 0x10f3ffe06 ElectronMain [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
30: 0x104439aa0  [/path/to/app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Helper (Renderer).app/Contents/MacOS/Electron Helper (Renderer)]
31: 0x10f33b4fe

Steps to Reproduce

It randomly happens and I cannot find a way to reproduce it at the moment.

Versions

  • keyboard-layout 2.0.17
  • Electron 16.0.4
  • macOS 12.0.1

Additional Information

Looks like the exception happens via KeyboardLayoutManager::HandleKeyboardLayoutChanged.
I haven't changed the keyboard layout but perhaps it is invoked when switching between English to Japanese input?
I'm using Google Japanese Input.
I would be happy to contribute. Please let me know where to fix.

nan failing to build

Hey, I am getting the following error when building this. Is it possible to change the nan version to ^2.8.0 so that the module can be properly installed? Thanks.

make: Entering directory '/tmp/pkg/src/franz-5.0.0-beta.18/node_modules/keyboard-layout/build'
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
In file included from ../../nan/nan.h:192,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan_maybe_43_inl.h: In function 'Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)':
../../nan/nan_maybe_43_inl.h:112:15: error: 'class v8::Object' has no member named 'ForceSet'
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
               ^~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:835:60: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h:835:60: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:850:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:165:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h:850:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:165:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)':
../../nan/nan.h:865:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:158:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h:865:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:158:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In member function 'v8::Local<v8::Value> Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const':
../../nan/nan.h:1479:5: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h:1479:5: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../../nan/nan.h:1732:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
../src/keyboard-layout-manager-linux.cc: At global scope:
/home/notroot/.node-gyp/10.6.0/include/node/node.h:537:43: warning: cast between incompatible function types from 'void (*)(v8::Handle<v8::Object>, v8::Handle<v8::Object>)' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/notroot/.node-gyp/10.6.0/include/node/node.h:571:3: note: in expansion of macro 'NODE_MODULE_X'
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/keyboard-layout-manager-linux.cc:22:1: note: in expansion of macro 'NODE_MODULE'
 NODE_MODULE(keyboard_layout_manager, KeyboardLayoutManager::Init)
 ^~~~~~~~~~~
In file included from /home/notroot/.node-gyp/10.6.0/include/node/node.h:63,
                 from ../../nan/nan.h:49,
                 from ../src/keyboard-layout-manager.h:4,
                 from ../src/keyboard-layout-manager-linux.cc:1:
/home/notroot/.node-gyp/10.6.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/home/notroot/.node-gyp/10.6.0/include/node/node_object_wrap.h:85:78:   required from here
/home/notroot/.node-gyp/10.6.0/include/node/v8.h:9360:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/notroot/.node-gyp/10.6.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../../nan/nan_object_wrap.h:66:61:   required from here
/home/notroot/.node-gyp/10.6.0/include/node/v8.h:9360:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
make: *** [keyboard-layout-manager.target.mk:103: Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Error 1
make: Leaving directory '/tmp/pkg/src/franz-5.0.0-beta.18/node_modules/keyboard-layout/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.17.4-1-zen
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /tmp/pkg/src/franz-5.0.0-beta.18/node_modules/keyboard-layout
gyp ERR! node -v v10.6.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok

Custom keyboard layouts – keyboard shortcuts work with wrong keys

Prerequisites

Description

Keyboard shortcuts work with wrong keys when using custom keyboard layouts.

Steps to Reproduce

  1. Install any custom layout (important: not provided by Apple) that keeps original qwerty bindings when command (⌘) is pressed. I will use customised Dvorak ⌘Qwerty for this example.
  2. Try using the shortcut for search bar (or any other shortcut).

Expected behavior:

I expected the search bar to open upon clicking qwerty's ⌘F (the fourth key in the middle row, as in Qwerty).

Actual behavior:

The search bar opens upon clicking qwerty's ⌘Y (the sixth key in the top row, as in Dvorak).

Reproduces how often:

Each time.

Versions

Atom 1.40.0 & MacOS Mojave 10.14.5

Additional Information

The issue is not present when using non-customised Dvorak ⌘qwerty layout (like here). In all other apps the problem does not occur neither.

Error in npm install

Hi there!
I am trying to install keyboard-layout through npm install --save keyboard-layout and I'm getting an error something like this. Can someone help me up with this error please?
image

Problem with `node-gyp rebuild` when installing

❯ npm i [email protected]
npm WARN lifecycle The node binary used for scripts is /Users/adam/.asdf/shims/node but npm is using /Users/adam/.asdf/installs/nodejs/8.9.4/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] install /private/tmp/dummy/node_modules/keyboard-layout
> node-gyp rebuild

nodejs 0.11.13 not installed
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! spawn ENOENT
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!     /Users/adam/.npm/_logs/2018-06-14T00_13_51_842Z-debug.log
❯ npm doctor
Check                               Value                        Recommendation
npm ping                            OK
npm -v                              v5.6.0                       Use npm v6.1.0
node -v                             v8.9.4                       Use node v8.11.3
npm config get registry             https://registry.npmjs.org/
which git                           /usr/local/bin/git
Perms check on cached files         ok
Perms check on global node_modules  ok
Perms check on local node_modules   ok
Verify cache contents               verified 2008 tarballs
Click to expand 2018-06-14T00_13_51_842Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/Users/adam/.asdf/installs/nodejs/8.9.4/bin/node',
1 verbose cli   '/Users/adam/.asdf/installs/nodejs/8.9.4/bin/npm',
1 verbose cli   'i',
1 verbose cli   '[email protected]' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 647e1bf826b375d2
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/keyboard-layout 12ms (from cache)
8 silly pacote version manifest for [email protected] fetched in 36ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly install loadAllDepsIntoIdealTree
13 silly resolveWithNewModule [email protected] checking installable status
14 http fetch GET 200 https://registry.npmjs.org/nan 4ms (from cache)
15 http fetch GET 200 https://registry.npmjs.org/event-kit 6ms (from cache)
16 silly pacote range manifest for nan@^2.0.0 fetched in 6ms
17 silly resolveWithNewModule [email protected] checking installable status
18 silly pacote range manifest for event-kit@^1.0.0 fetched in 8ms
19 silly resolveWithNewModule [email protected] checking installable status
20 http fetch GET 200 https://registry.npmjs.org/grim 2ms (from cache)
21 silly pacote range manifest for grim@^1.2.1 fetched in 3ms
22 silly resolveWithNewModule [email protected] checking installable status
23 http fetch GET 200 https://registry.npmjs.org/emissary 1ms (from cache)
24 silly pacote range manifest for emissary@^1.2.0 fetched in 2ms
25 silly resolveWithNewModule [email protected] checking installable status
26 http fetch GET 200 https://registry.npmjs.org/underscore-plus 12ms (from cache)
27 http fetch GET 200 https://registry.npmjs.org/mixto 10ms (from cache)
28 http fetch GET 200 https://registry.npmjs.org/property-accessors 10ms (from cache)
29 http fetch GET 200 https://registry.npmjs.org/es6-weak-map 11ms (from cache)
30 silly pacote range manifest for [email protected] fetched in 14ms
31 silly resolveWithNewModule [email protected] checking installable status
32 silly pacote range manifest for [email protected] fetched in 13ms
33 silly resolveWithNewModule [email protected] checking installable status
34 silly pacote range manifest for property-accessors@^1.1 fetched in 13ms
35 silly resolveWithNewModule [email protected] checking installable status
36 silly pacote range manifest for es6-weak-map@^0.1.2 fetched in 13ms
37 silly resolveWithNewModule [email protected] checking installable status
38 http fetch GET 200 https://registry.npmjs.org/d 3ms (from cache)
39 http fetch GET 200 https://registry.npmjs.org/es6-iterator 3ms (from cache)
40 http fetch GET 200 https://registry.npmjs.org/es6-symbol 3ms (from cache)
41 silly pacote range manifest for d@~0.1.1 fetched in 4ms
42 silly resolveWithNewModule [email protected] checking installable status
43 silly pacote range manifest for es6-iterator@~0.1.3 fetched in 4ms
44 silly resolveWithNewModule [email protected] checking installable status
45 silly pacote range manifest for es6-symbol@~2.0.1 fetched in 5ms
46 silly resolveWithNewModule [email protected] checking installable status
47 http fetch GET 200 https://registry.npmjs.org/underscore 2ms (from cache)
48 silly pacote range manifest for underscore@~1.8.3 fetched in 3ms
49 silly resolveWithNewModule [email protected] checking installable status
50 silly currentTree [email protected]
50 silly currentTree ├─┬ [email protected]
50 silly currentTree │ ├── [email protected]
50 silly currentTree │ ├── [email protected]
50 silly currentTree │ └── [email protected]
50 silly currentTree └── [email protected]
51 silly idealTree [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├─┬ [email protected]
51 silly idealTree │ ├── [email protected]
51 silly idealTree │ ├── [email protected]
51 silly idealTree │ └── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree ├── [email protected]
51 silly idealTree └── [email protected]
52 silly install generateActionsToTake
53 silly diffTrees action count 13
54 silly diffTrees add [email protected]
55 silly diffTrees add [email protected]
56 silly diffTrees add [email protected]
57 silly diffTrees add [email protected]
58 silly diffTrees add [email protected]
59 silly diffTrees add [email protected]
60 silly diffTrees add [email protected]
61 silly diffTrees add [email protected]
62 silly diffTrees add [email protected]
63 silly diffTrees add [email protected]
64 silly diffTrees add [email protected]
65 silly diffTrees add [email protected]
66 silly diffTrees add [email protected]
67 silly decomposeActions action count 104
68 silly decomposeActions fetch [email protected]
69 silly decomposeActions extract [email protected]
70 silly decomposeActions preinstall [email protected]
71 silly decomposeActions build [email protected]
72 silly decomposeActions install [email protected]
73 silly decomposeActions postinstall [email protected]
74 silly decomposeActions finalize [email protected]
75 silly decomposeActions refresh-package-json [email protected]
76 silly decomposeActions fetch [email protected]
77 silly decomposeActions extract [email protected]
78 silly decomposeActions preinstall [email protected]
79 silly decomposeActions build [email protected]
80 silly decomposeActions install [email protected]
81 silly decomposeActions postinstall [email protected]
82 silly decomposeActions finalize [email protected]
83 silly decomposeActions refresh-package-json [email protected]
84 silly decomposeActions fetch [email protected]
85 silly decomposeActions extract [email protected]
86 silly decomposeActions preinstall [email protected]
87 silly decomposeActions build [email protected]
88 silly decomposeActions install [email protected]
89 silly decomposeActions postinstall [email protected]
90 silly decomposeActions finalize [email protected]
91 silly decomposeActions refresh-package-json [email protected]
92 silly decomposeActions fetch [email protected]
93 silly decomposeActions extract [email protected]
94 silly decomposeActions preinstall [email protected]
95 silly decomposeActions build [email protected]
96 silly decomposeActions install [email protected]
97 silly decomposeActions postinstall [email protected]
98 silly decomposeActions finalize [email protected]
99 silly decomposeActions refresh-package-json [email protected]
100 silly decomposeActions fetch [email protected]
101 silly decomposeActions extract [email protected]
102 silly decomposeActions preinstall [email protected]
103 silly decomposeActions build [email protected]
104 silly decomposeActions install [email protected]
105 silly decomposeActions postinstall [email protected]
106 silly decomposeActions finalize [email protected]
107 silly decomposeActions refresh-package-json [email protected]
108 silly decomposeActions fetch [email protected]
109 silly decomposeActions extract [email protected]
110 silly decomposeActions preinstall [email protected]
111 silly decomposeActions build [email protected]
112 silly decomposeActions install [email protected]
113 silly decomposeActions postinstall [email protected]
114 silly decomposeActions finalize [email protected]
115 silly decomposeActions refresh-package-json [email protected]
116 silly decomposeActions fetch [email protected]
117 silly decomposeActions extract [email protected]
118 silly decomposeActions preinstall [email protected]
119 silly decomposeActions build [email protected]
120 silly decomposeActions install [email protected]
121 silly decomposeActions postinstall [email protected]
122 silly decomposeActions finalize [email protected]
123 silly decomposeActions refresh-package-json [email protected]
124 silly decomposeActions fetch [email protected]
125 silly decomposeActions extract [email protected]
126 silly decomposeActions preinstall [email protected]
127 silly decomposeActions build [email protected]
128 silly decomposeActions install [email protected]
129 silly decomposeActions postinstall [email protected]
130 silly decomposeActions finalize [email protected]
131 silly decomposeActions refresh-package-json [email protected]
132 silly decomposeActions fetch [email protected]
133 silly decomposeActions extract [email protected]
134 silly decomposeActions preinstall [email protected]
135 silly decomposeActions build [email protected]
136 silly decomposeActions install [email protected]
137 silly decomposeActions postinstall [email protected]
138 silly decomposeActions finalize [email protected]
139 silly decomposeActions refresh-package-json [email protected]
140 silly decomposeActions fetch [email protected]
141 silly decomposeActions extract [email protected]
142 silly decomposeActions preinstall [email protected]
143 silly decomposeActions build [email protected]
144 silly decomposeActions install [email protected]
145 silly decomposeActions postinstall [email protected]
146 silly decomposeActions finalize [email protected]
147 silly decomposeActions refresh-package-json [email protected]
148 silly decomposeActions fetch [email protected]
149 silly decomposeActions extract [email protected]
150 silly decomposeActions preinstall [email protected]
151 silly decomposeActions build [email protected]
152 silly decomposeActions install [email protected]
153 silly decomposeActions postinstall [email protected]
154 silly decomposeActions finalize [email protected]
155 silly decomposeActions refresh-package-json [email protected]
156 silly decomposeActions fetch [email protected]
157 silly decomposeActions extract [email protected]
158 silly decomposeActions preinstall [email protected]
159 silly decomposeActions build [email protected]
160 silly decomposeActions install [email protected]
161 silly decomposeActions postinstall [email protected]
162 silly decomposeActions finalize [email protected]
163 silly decomposeActions refresh-package-json [email protected]
164 silly decomposeActions fetch [email protected]
165 silly decomposeActions extract [email protected]
166 silly decomposeActions preinstall [email protected]
167 silly decomposeActions build [email protected]
168 silly decomposeActions install [email protected]
169 silly decomposeActions postinstall [email protected]
170 silly decomposeActions finalize [email protected]
171 silly decomposeActions refresh-package-json [email protected]
172 silly install executeActions
173 silly doSerial global-install 104
174 verbose correctMkdir /Users/adam/.npm/_locks correctMkdir not in flight; initializing
175 verbose lock using /Users/adam/.npm/_locks/staging-9b558a35c3408069.lock for /private/tmp/dummy/node_modules/.staging
176 silly doParallel extract 104
177 silly extract [email protected]
178 silly extract [email protected]
179 silly extract [email protected]
180 silly extract [email protected]
181 silly extract [email protected]
182 silly extract [email protected]
183 silly extract [email protected]
184 silly extract [email protected]
185 silly extract [email protected]
186 silly extract [email protected]
187 silly extract [email protected]
188 silly extract [email protected]
189 silly extract [email protected]
190 silly doReverseSerial unbuild 104
191 silly doSerial remove 104
192 silly doSerial move 104
193 silly doSerial finalize 104
194 silly finalize /private/tmp/dummy/node_modules/d
195 silly finalize /private/tmp/dummy/node_modules/es6-symbol
196 silly finalize /private/tmp/dummy/node_modules/es6-iterator
197 silly finalize /private/tmp/dummy/node_modules/es6-weak-map
198 silly finalize /private/tmp/dummy/node_modules/mixto
199 silly finalize /private/tmp/dummy/node_modules/property-accessors
200 silly finalize /private/tmp/dummy/node_modules/underscore
201 silly finalize /private/tmp/dummy/node_modules/underscore-plus
202 silly finalize /private/tmp/dummy/node_modules/emissary
203 silly finalize /private/tmp/dummy/node_modules/grim
204 silly finalize /private/tmp/dummy/node_modules/event-kit
205 silly finalize /private/tmp/dummy/node_modules/nan
206 silly finalize /private/tmp/dummy/node_modules/keyboard-layout
207 silly doParallel refresh-package-json 104
208 silly refresh-package-json /private/tmp/dummy/node_modules/d
209 silly refresh-package-json /private/tmp/dummy/node_modules/es6-symbol
210 silly refresh-package-json /private/tmp/dummy/node_modules/es6-iterator
211 silly refresh-package-json /private/tmp/dummy/node_modules/es6-weak-map
212 silly refresh-package-json /private/tmp/dummy/node_modules/mixto
213 silly refresh-package-json /private/tmp/dummy/node_modules/property-accessors
214 silly refresh-package-json /private/tmp/dummy/node_modules/underscore
215 silly refresh-package-json /private/tmp/dummy/node_modules/underscore-plus
216 silly refresh-package-json /private/tmp/dummy/node_modules/emissary
217 silly refresh-package-json /private/tmp/dummy/node_modules/grim
218 silly refresh-package-json /private/tmp/dummy/node_modules/event-kit
219 silly refresh-package-json /private/tmp/dummy/node_modules/nan
220 silly refresh-package-json /private/tmp/dummy/node_modules/keyboard-layout
221 silly doParallel preinstall 104
222 silly preinstall [email protected]
223 info lifecycle [email protected]~preinstall: [email protected]
224 silly preinstall [email protected]
225 info lifecycle [email protected]~preinstall: [email protected]
226 silly preinstall [email protected]
227 info lifecycle [email protected]~preinstall: [email protected]
228 silly preinstall [email protected]
229 info lifecycle [email protected]~preinstall: [email protected]
230 silly preinstall [email protected]
231 info lifecycle [email protected]~preinstall: [email protected]
232 silly preinstall [email protected]
233 info lifecycle [email protected]~preinstall: [email protected]
234 silly preinstall [email protected]
235 info lifecycle [email protected]~preinstall: [email protected]
236 silly preinstall [email protected]
237 info lifecycle [email protected]~preinstall: [email protected]
238 silly preinstall [email protected]
239 info lifecycle [email protected]~preinstall: [email protected]
240 silly preinstall [email protected]
241 info lifecycle [email protected]~preinstall: [email protected]
242 silly preinstall [email protected]
243 info lifecycle [email protected]~preinstall: [email protected]
244 silly preinstall [email protected]
245 info lifecycle [email protected]~preinstall: [email protected]
246 silly preinstall [email protected]
247 info lifecycle [email protected]~preinstall: [email protected]
248 silly doSerial build 104
249 silly build [email protected]
250 info linkStuff [email protected]
251 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
252 verbose linkBins [email protected]
253 verbose linkMans [email protected]
254 silly build [email protected]
255 info linkStuff [email protected]
256 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
257 verbose linkBins [email protected]
258 verbose linkMans [email protected]
259 silly build [email protected]
260 info linkStuff [email protected]
261 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
262 verbose linkBins [email protected]
263 verbose linkMans [email protected]
264 silly build [email protected]
265 info linkStuff [email protected]
266 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
267 verbose linkBins [email protected]
268 verbose linkMans [email protected]
269 silly build [email protected]
270 info linkStuff [email protected]
271 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
272 verbose linkBins [email protected]
273 verbose linkMans [email protected]
274 silly build [email protected]
275 info linkStuff [email protected]
276 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
277 verbose linkBins [email protected]
278 verbose linkMans [email protected]
279 silly build [email protected]
280 info linkStuff [email protected]
281 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
282 verbose linkBins [email protected]
283 verbose linkMans [email protected]
284 silly build [email protected]
285 info linkStuff [email protected]
286 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
287 verbose linkBins [email protected]
288 verbose linkMans [email protected]
289 silly build [email protected]
290 info linkStuff [email protected]
291 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
292 verbose linkBins [email protected]
293 verbose linkMans [email protected]
294 silly build [email protected]
295 info linkStuff [email protected]
296 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
297 verbose linkBins [email protected]
298 verbose linkMans [email protected]
299 silly build [email protected]
300 info linkStuff [email protected]
301 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
302 verbose linkBins [email protected]
303 verbose linkMans [email protected]
304 silly build [email protected]
305 info linkStuff [email protected]
306 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
307 verbose linkBins [email protected]
308 verbose linkMans [email protected]
309 silly build [email protected]
310 info linkStuff [email protected]
311 silly linkStuff [email protected] has /private/tmp/dummy/node_modules as its parent node_modules
312 verbose linkBins [email protected]
313 verbose linkMans [email protected]
314 silly doSerial global-link 104
315 silly doParallel update-linked 104
316 silly doSerial install 104
317 silly install [email protected]
318 info lifecycle [email protected]~install: [email protected]
319 silly install [email protected]
320 info lifecycle [email protected]~install: [email protected]
321 silly install [email protected]
322 info lifecycle [email protected]~install: [email protected]
323 silly install [email protected]
324 info lifecycle [email protected]~install: [email protected]
325 silly install [email protected]
326 info lifecycle [email protected]~install: [email protected]
327 silly install [email protected]
328 info lifecycle [email protected]~install: [email protected]
329 silly install [email protected]
330 info lifecycle [email protected]~install: [email protected]
331 silly install [email protected]
332 info lifecycle [email protected]~install: [email protected]
333 silly install [email protected]
334 info lifecycle [email protected]~install: [email protected]
335 silly install [email protected]
336 info lifecycle [email protected]~install: [email protected]
337 silly install [email protected]
338 info lifecycle [email protected]~install: [email protected]
339 silly install [email protected]
340 info lifecycle [email protected]~install: [email protected]
341 silly install [email protected]
342 info lifecycle [email protected]~install: [email protected]
343 warn lifecycle The node binary used for scripts is /Users/adam/.asdf/shims/node but npm is using /Users/adam/.asdf/installs/nodejs/8.9.4/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
344 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
345 verbose lifecycle [email protected]~install: PATH: /Users/adam/.asdf/installs/nodejs/8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/private/tmp/dummy/node_modules/keyboard-layout/node_modules/.bin:/private/tmp/dummy/node_modules/.bin:/Users/adam/.asdf/shims:/Users/adam/.asdf/bin:.git/safe/../../scripts:/Users/adam/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/adam/.fzf/bin:/Users/adam/Code/go/bin:/usr/local/heroku/bin:/Users/adamyonk/.cargo/bin
346 verbose lifecycle [email protected]~install: CWD: /private/tmp/dummy/node_modules/keyboard-layout
347 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
348 info lifecycle [email protected]~install: Failed to exec install script
349 verbose unlock done using /Users/adam/.npm/_locks/staging-9b558a35c3408069.lock for /private/tmp/dummy/node_modules/.staging
350 silly saveTree [email protected]
350 silly saveTree └─┬ [email protected]
350 silly saveTree   ├─┬ [email protected]
350 silly saveTree   │ └─┬ [email protected]
350 silly saveTree   │   └─┬ [email protected]
350 silly saveTree   │     ├─┬ [email protected]
350 silly saveTree   │     │ ├─┬ [email protected]
350 silly saveTree   │     │ │ └─┬ [email protected]
350 silly saveTree   │     │ │   ├─┬ [email protected]
350 silly saveTree   │     │ │   │ ├── [email protected]
350 silly saveTree   │     │ │   │ └── [email protected]
350 silly saveTree   │     │ │   ├── [email protected]
350 silly saveTree   │     │ │   └── [email protected]
350 silly saveTree   │     │ ├── [email protected]
350 silly saveTree   │     │ ├─┬ [email protected]
350 silly saveTree   │     │ │ └── [email protected]
350 silly saveTree   │     │ └── [email protected]
350 silly saveTree   │     ├── [email protected]
350 silly saveTree   │     ├── [email protected]
350 silly saveTree   │     └─┬ [email protected]
350 silly saveTree   │       └── [email protected]
350 silly saveTree   └── [email protected]
351 warn [email protected] No description
352 warn [email protected] No repository field.
353 verbose stack Error: [email protected] install: `node-gyp rebuild`
353 verbose stack spawn ENOENT
353 verbose stack     at ChildProcess. (/Users/adam/.asdf/installs/nodejs/8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
353 verbose stack     at emitTwo (events.js:126:13)
353 verbose stack     at ChildProcess.emit (events.js:214:7)
353 verbose stack     at maybeClose (internal/child_process.js:925:16)
353 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
354 verbose pkgid [email protected]
355 verbose cwd /private/tmp/dummy
356 verbose Darwin 17.6.0
357 verbose argv "/Users/adam/.asdf/installs/nodejs/8.9.4/bin/node" "/Users/adam/.asdf/installs/nodejs/8.9.4/bin/npm" "i" "[email protected]"
358 verbose node v8.9.4
359 verbose npm  v5.6.0
360 error file sh
361 error code ELIFECYCLE
362 error errno ENOENT
363 error syscall spawn
364 error [email protected] install: `node-gyp rebuild`
364 error spawn ENOENT
365 error Failed at the [email protected] install script.
365 error This is probably not a problem with npm. There is likely additional logging output above.
366 verbose exit [ 1, true ]

Set keyboard layout

Would be awesome to be able to force keyboard layout like we can do in Alfred. So when you switch to the atom -- it will set selected keyboard layout automatically.

image

As I understood currently with this package we can only watch, not set the keyboard layout.

Build error

@cidevant ~/Code/JavaScript/Atom.io/atom-keymap-official [master] $ npm install keyboard-layout
npm WARN package.json [email protected] No repository field.
-
> [email protected] install /Users/cidevant/Code/JavaScript/Atom.io/atom-keymap-official/node_modules/keyboard-layout
> node-gyp rebuild

  CXX(target) Release/obj.target/keyboard-layout-observer/src/keyboard-layout-observer-mac.o
../src/keyboard-layout-observer-mac.mm:42:3: error: no matching function for call to 'uv_async_init'
  uv_async_init(loop, &async, asyncSendHandler);
  ^~~~~~~~~~~~~
/Users/cidevant/.node-gyp/0.10.28/deps/uv/include/uv.h:1192:15: note: candidate function not viable: no known conversion from 'void (uv_async_t *)' to
      'uv_async_cb' (aka 'void (*)(uv_async_t *, int)') for 3rd argument
UV_EXTERN int uv_async_init(uv_loop_t*, uv_async_t* async,
              ^
1 error generated.
make: *** [Release/obj.target/keyboard-layout-observer/src/keyboard-layout-observer-mac.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cidevant/Code/JavaScript/Atom.io/atom-keymap-official/node_modules/keyboard-layout
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "keyboard-layout"
npm ERR! node v0.10.28
npm ERR! npm  v2.0.0
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.
npm ERR! This is most likely a problem with the keyboard-layout 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 their info via:
npm ERR!     npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

32bit windows build fails with Electron 10

Prerequisites

Description

When building the solution for x86 (32bit Windows) using MSBuild.exe it fails on C4309 warning. I'm using this module with Electron 10.

Steps to Reproduce

  1. Clone the repo.
  2. Build the solution in VS using 32 architecture.
  3. Build fails with error on C4309 warning.

Expected behavior:

Warning is ignored and build completes.

Actual behavior:

Warning is thrown and build is interrupted.

Reproduces how often:

100%

Versions

2.0.16

Additional Information

This can be mitigated by using either one of these

  • /WX- switch to ignore warnings
  • changing 'WarnAsError': 'false' in binding.gyp
  • adding 4309 to the ignored warnings list in binding.gyp

Pull request with change will be created.

observeCurrentKeyboardLayout not working when invoke by node

I have code

const KeyboardLayout = require('keyboard-layout')

let subscription = KeyboardLayout.observeCurrentKeyboardLayout((layout) => console.log(layout))

and run node test.js
I can get the output after first run, but no more when I change keyboard layout.

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.