Closed speedpacer closed 5 years ago
Having the exact same issue. In the beginning I defined each of my accelarators seperately, but I had a few that were duplicate key registrations, which it did not like. So, following the docs, I turned these into an array of accelerators in the register()
method. When I call register()
with an array of accelerators it hits the _checkAccelerator()
call it goes all fubar. Looking at the source code I tried a quick test to check the accelerator
argument type and process it differently
if (Array.isArray(accelerator)) {
accelerator.forEach(key => {
_checkAccelerator(key);
});
} else {
_checkAccelerator(accelerator);
}
This got it past that error, but then others followed once it tried to pass the array into the toKeyEvent()
. I tried to code around that too, but then I started getting all kinds of error in the app itself on load.
Could you check the version actually in master to see if it solve the problem? If you use an invalid shortcut chord, toy should see a warning in the console...
@parro-it, it happens when you are trying to pass an array of shortcuts. For example:
electronLocalshortcut.register(window, ['Cmd+S', 'Ctrl+S'], () => {
window.webContents.send('save-card');
});
electron-localshortcut v3.1.0 electron v3.0.2 macOS v10.13.6
Should be solved by https://github.com/parro-it/electron-localshortcut/pull/50 I'll publish a new release soon.
I just installed and configured as instructed and I get this error when I launch electron.
This a new project, started with create-react-app and then adding electron, the standard main.js file from electron-quick-start, and the few necessary changes to package.json. I also added a .env file with BROWSER=none and a different port and I'm using concurrently and wait-on to start react in the electron window.
Could one of these things be interfering?