rubick-native icon indicating copy to clipboard operation
rubick-native copied to clipboard

在 electron macos 环境下 使用onInputEvent 点击任意键盘程序会闪退

Open lie5860 opened this issue 1 year ago • 0 comments

单独的在 nodejs 中使用没有问题。 安装 electron main.js 填写简单的示例代码。一开始捕获好像都很正常。焦点放到了新建的窗口上。按一个按钮程序就会闪退

const {app, BrowserWindow} = require('electron');
const {onInputEvent} = require('rubick-native')
const createWindow = () => {
    const win = new BrowserWindow({
        width: 800,
        height: 600
    })
    win.show()
}
console.log(`app whenReady`);
app.whenReady().then(() => {
    createWindow();
    onInputEvent((e) => {
        console.log(`onInputEvent`);
    })
})

{
  "name": "untitled",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "electron ./main.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "rubick-native": "0.0.16-beta",
    "rubick-native-addon": "0.0.16-beta",
    "rubick-native-addon-darwin-arm64": "^0.0.15-beta"
  },
  "devDependencies": {
    "electron": "^29.1.4"
  }
}

或者有没有办法只监听鼠标的。。键盘事件跳过。。。

lie5860 avatar Mar 20 '24 12:03 lie5860