我最近去了吉特布的电子文档。他们使用的例子之一
const electron = require('electron') const app = electron.app const dialog = electron.dialog const globalShortcut = electron.globalShortcut
app.on('ready', function () { globalShortcut.register('CommandOrControl+Alt+K', function () {
dialog.showMessageBox({
type: 'info',
message: 'Success!',
detail: 'You pressed the registered global shortcut keybinding.',
buttons: ['OK']
}) }) })
app.on('will-quit', function () { globalShortcut.unregisterAll() })这似乎是键盘挂钩的跨平台解决方案。但是,上面的示例全局注册了键盘快捷方式。是否可以在不妨碍用户的情况下注册所有击键?例如,如果我按下。' ctrl+w‘在我的网络浏览器上,我希望我的选举人应用程序注册ctrl+w,而不是阻碍它在weeb浏览器上的功能。
有可能这样做吗?
发布于 2016-11-01 00:08:31
电子团队已经研究了这一特性的可能实现,并拒绝了一个相关的github问题,因为由于安全性和可用性方面的考虑,它无法修复。
https://stackoverflow.com/questions/40340542
复制相似问题