I am trying to disable all keyboard shortcuts in my electron.js app.
I tried the following ways (spoiler alert: they didn't work):
globalShortcut.unregisterAll()
and
globalShortcut.register('Alt+CommandOrControl+A', () => {
console.log('not allowed')
})
globalShortcut.register('Alt+CommandOrControl+B', () => {
console.log('not allowed')
})
globalShortcut.register('Alt+CommandOrControl+C', () => {
console.log('not allowed')
})
globalShortcut.register('Alt+CommandOrControl+D', () => {
console.log('not allowed') // and so on
})
(i did this ^ for all the keys (from A to Z, 1 to 9, etc).
By the way, all of the code I tried I put into the app.whenReady()
function.
Well, none of this worked. I saw a lot of articles with other more abstract ways, but they didn't work either. I actually tried searching for an npm package too, but I didn't find any that would solve my problem.
I just need to completely disable all keyboard shortcuts from my electron app. Is there any other way (that actually works)?