parro-it / electron-localshortcut

Add keyboard shortcuts locally to a BrowserWindow instance, without using a Menu
MIT License
422 stars 38 forks source link

On azerty keyboard, "w" is triggered by both "w" and "z" #99

Open jean-emmanuel opened 4 years ago

jean-emmanuel commented 4 years ago

Hi, With an azerty keyboard, the input object can looks like this:

{
  type: 'keyDown',
  key: 'w',
  code: 'KeyZ',
  // ...
}
// or 
{
  type: 'keyDown',
  key: 'z',
  code: 'KeyW',
  // ...
}

The input comparison fails to differentiate these cases. It does not occur with electron global shortcuts.

jean-emmanuel commented 4 years ago

It seems the root cause is toKeyEvent('w') returning { key: 'w', code: 'KeyW' } regardless of the keyboard layout.