testing
This commit is contained in:
parent
99f4ed0b05
commit
c3db4d4286
@ -4,7 +4,6 @@ html, body{
|
|||||||
margin:0px;
|
margin:0px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: green;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
|
12
main.js
12
main.js
@ -1,5 +1,5 @@
|
|||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const {app, BrowserWindow} = require('electron')
|
const {app, BrowserWindow, ipcRenderer} = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
@ -59,11 +59,17 @@ app.on('activate', function () {
|
|||||||
const ioHook = require('iohook');
|
const ioHook = require('iohook');
|
||||||
|
|
||||||
ioHook.on('mousedown', event => {
|
ioHook.on('mousedown', event => {
|
||||||
console.log(event);
|
if (event.button == '4') {
|
||||||
|
console.log("mouse4 down")
|
||||||
|
mainWindow.webContents.send('ping', 'mic-open')
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ioHook.on('mouseup', event => {
|
ioHook.on('mouseup', event => {
|
||||||
console.log(event);
|
if (event.button == '4') {
|
||||||
|
console.log("mouse4 up")
|
||||||
|
mainWindow.webContents.send('ping', 'mic-closed')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// Register and start hook
|
// Register and start hook
|
||||||
ioHook.start();
|
ioHook.start();
|
||||||
|
20
renderer.js
20
renderer.js
@ -1,3 +1,17 @@
|
|||||||
// This file is required by the index.html file and will
|
let robot = require("kbm-robot");
|
||||||
// be executed in the renderer process for that window.
|
robot.startJar();
|
||||||
// All of the Node.js APIs are available in this process.
|
|
||||||
|
require('electron').ipcRenderer.on('ping', (event, message) => {
|
||||||
|
if (message === 'mic-open'){
|
||||||
|
console.log("mic is open")
|
||||||
|
robot.press("n").go()
|
||||||
|
}
|
||||||
|
if (message === 'mic-closed'){
|
||||||
|
console.log("mic is closed")
|
||||||
|
robot.release("n").go()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function (e) {
|
||||||
|
console.log('Key: ' + e.key + ' pressed');
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user