gpt4 book ai didi

javascript - NodeJS/Electron : Is it possible to register “STRG+<” as a globalShortcut and how can I do this?

转载 作者:行者123 更新时间:2023-12-03 12:43:23 25 4
gpt4 key购买 nike

我正在尝试将STRG+<注册为 Electron 应用程序中的globalShortcut
可以使用autoit注册此热键,所以我认为nodejs/electron不能。

你能帮我么?

以下热键正在工作:CommandOrControl+X
这不起作用:CommandOrControl+<
在互联网上,我没有找到相应的Java键盘代码。

const globalHotkey = globalShortcut.register('CommandOrControl+X', () => {
console.log('CommandOrControl+X is pressed')
})
if (!globalHotkey) {
console.log('registration failed')
}

最佳答案

有人帮助了我,并建议了ioHook。

https://discuss.atom.io/t/register-strg-as-a-globalshortcut-in-electron/66963/2

const ioHook = require('iohook')
// register "STRG+<"
const id = ioHook.registerShortcut([29, 0], (keys) => {
console.log('-----------------------------')
console.log('Shortcut was pressed:', keys)
})

关于javascript - NodeJS/Electron : Is it possible to register “STRG+<” as a globalShortcut and how can I do this?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57131956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com