parro-it/electron-localshortcut

Does not respect alternate keyboard layouts?

chadoh opened this issue · 1 comments

I'm trying out the Brave browser and I noticed that it doesn't currently register its keyboard shortcuts correctly. I assume they're busy with all sorts of other things and don't have time to help a picky Dvorak user such as me, so I figured I'd help them out. I'm new to electron but familiar with JS & React & webpack, etc.

The issue

I use the Dvorak keyboard layout. When I press cmdshift] to try to switch tabs, Brave-via-electronlocalshortcut looks at the key position rather than the character typed, and instead sends cmdshift+. I zoom in instead of switching tabs.

The code

Here's how they define their shortcuts. Essentially:

const electronLocalshortcut = require('electron-localshortcut')

module.exports.register = win => {
  electronLocalshortcut.register(win, 'CmdOrCtrl+Shift+]', () => {...})
}

What's wrong?

Is there something that they did wrong, or is this an error in electron-localshortcut? Point me in the right direction and I can help fix the issue.

Thanks!

Hi @chadoh, thank you for your detailed issue...

Is there something that they did wrong, or is this an error in electron-localshortcut?

Neither... they're using this module right well, and no there's no bug on electron-localshortcut side:
I simply pass the shortcut Accelerator parameter to electron globalShortcuts methods, I don't do any changes or traslation to the keycode you passes.

So I guess you'll have to repost this issue to Electron repo: it's should be his responsibility to interpret keycode Accelerator used.