From 3d47759b0f2e7308a1bd9be1ac8b131ee7d0ad3a Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 21 Nov 2016 19:05:48 +0100 Subject: [PATCH] Allow pass filename cmd line https://github.com/mifi/lossless-cut/issues/9 --- src/index.js | 7 +++++++ src/renderer.jsx | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/index.js b/src/index.js index e6dfe75f..c243ce82 100644 --- a/src/index.js +++ b/src/index.js @@ -48,3 +48,10 @@ app.on('activate', () => { createWindow(); } }); + +electron.ipcMain.on('renderer-ready', () => { + if (!isDev) { + const fileToOpen = process.argv[1]; + if (fileToOpen) mainWindow.webContents.send('file-opened', [fileToOpen]); + } +}); diff --git a/src/renderer.jsx b/src/renderer.jsx index e2948440..2f4f9646 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -111,6 +111,8 @@ class App extends React.Component { keyboardJs.bind('e', () => this.cutClick()); keyboardJs.bind('i', () => this.setCutStart()); keyboardJs.bind('o', () => this.setCutEnd()); + + electron.ipcRenderer.send('renderer-ready'); } onPlay(playing) {