I am new to electron and I use the plugin https://www.npmjs.com/package/iohook to get the key strokes pressed by the user. It requires permission of accessibility in system