hey it all works

This commit is contained in:
Andrew Morgan 2019-02-21 23:23:58 +00:00
parent 65a501ff2b
commit 7ea207327f
2 changed files with 19 additions and 15 deletions

View File

@ -12,21 +12,6 @@
"minimist": "^1.2.0",
"png-to-ico": "^1.0.2"
},
"iohook": {
"targets": [
"node-64",
"electron-69"
],
"platforms": [
"win32",
"darwin",
"linux"
],
"arches": [
"x64",
"ia32"
]
},
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "4.0.4"

View File

@ -218,6 +218,25 @@ export default class ElectronPlatform extends VectorBasePlatform {
ipcRenderer.send('check_updates');
}
startListeningKeys() {
// Tell iohook to start listening for key events
ipcRenderer.send('start-listening-keys');
}
stopListeningKeys() {
// Tell iohook to stop listening for key events
ipcRenderer.send('stop-listening-keys');
}
onKeypress(self: any, callback: (ev, event) => void ) {
ipcRenderer.on('keypress', callback.bind(self));
}
onWindowBlurred(callback: () => void) {
// Callback to run on window blur (window loses focus)
ipcRenderer.on('window-blurred', callback);
}
addGlobalKeybinding(keybindName: string, keybindCode: string, callback: () => void, releaseCallback: () => void) {
// Add a keybinding that works even when the app is minimized
const keybinding = {name: keybindName, code: keybindCode};