diff --git a/main.js b/main.js index cc82598..48d8d5d 100644 --- a/main.js +++ b/main.js @@ -28,6 +28,7 @@ function createWindow () { width: 800, height: 600, frame: true, + fullScreen: true, webPreferences: { nodeIntegration: true, nodeIntegrationInWorker: true, @@ -174,9 +175,16 @@ ipcMain.on('fullscreen', (event, arg) => { console.log('Setting to fullscreen ' + arg); win.setFullScreen(arg); }) -ipcMain.on('sendKeys', (event, arg) => { + +function sendKeybinding (win, modifiers, keyCode) { + win.webContents.sendInputEvent({ type: 'keyDown', modifiers, keyCode }) + win.webContents.sendInputEvent({ type: 'char', modifiers, keyCode }) + win.webContents.sendInputEvent({ type: 'keyUp', modifiers, keyCode }) +} + +ipcMain.on('sendKeys', (event, modifiers, keyCode) => { console.log('Sending keys: '+arg); -sendkeys.send(arg); + sendKeybinding(win, modifiers, keyCode); }) ipcMain.on('listFiles', (event, arg) => { console.log('Listing all files and directories in ' + arg);