Skip to content

Commit 7ea2073

Browse files
committed
hey it all works
1 parent 65a501f commit 7ea2073

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

electron_app/package.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@
1212
"minimist": "^1.2.0",
1313
"png-to-ico": "^1.0.2"
1414
},
15-
"iohook": {
16-
"targets": [
17-
"node-64",
18-
"electron-69"
19-
],
20-
"platforms": [
21-
"win32",
22-
"darwin",
23-
"linux"
24-
],
25-
"arches": [
26-
"x64",
27-
"ia32"
28-
]
29-
},
3015
"cmake-js": {
3116
"runtime": "electron",
3217
"runtimeVersion": "4.0.4"

src/vector/platform/ElectronPlatform.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,25 @@ export default class ElectronPlatform extends VectorBasePlatform {
218218
ipcRenderer.send('check_updates');
219219
}
220220

221+
startListeningKeys() {
222+
// Tell iohook to start listening for key events
223+
ipcRenderer.send('start-listening-keys');
224+
}
225+
226+
stopListeningKeys() {
227+
// Tell iohook to stop listening for key events
228+
ipcRenderer.send('stop-listening-keys');
229+
}
230+
231+
onKeypress(self: any, callback: (ev, event) => void ) {
232+
ipcRenderer.on('keypress', callback.bind(self));
233+
}
234+
235+
onWindowBlurred(callback: () => void) {
236+
// Callback to run on window blur (window loses focus)
237+
ipcRenderer.on('window-blurred', callback);
238+
}
239+
221240
addGlobalKeybinding(keybindName: string, keybindCode: string, callback: () => void, releaseCallback: () => void) {
222241
// Add a keybinding that works even when the app is minimized
223242
const keybinding = {name: keybindName, code: keybindCode};

0 commit comments

Comments
 (0)