Skip to content

The swiss army knife of lossless video/audio editing

implement focus on drop #335

Mikael Finstad77da0299f09f
diff --git a/public/electron.js b/public/electron.js
index 378063ba..3f0670b8 100644
--- a/public/electron.js
+++ b/public/electron.js
@@ -130,4 +130,12 @@ electron.ipcMain.on('setAskBeforeClose', (e, val) => {
askBeforeClose = val;
});
-module.exports = { configStore };
+function focusWindow() {
+ try {
+ if (mainWindow) mainWindow.webContents.focus();
+ } catch (err) {
+ console.error('Failed to focus window', err);
+ }
+}
+
+module.exports = { focusWindow };
diff --git a/src/App.jsx b/src/App.jsx
index c8c82d62..c2cc7d45 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -65,6 +65,7 @@ const { extname } = window.require('path');
const { dialog, app } = electron.remote;
const configStore = electron.remote.require('./configStore');
+// const { focusWindow } = electron.remote.require('./electron');
const ReactSwal = withReactContent(Swal);
@@ -1370,6 +1371,9 @@ const App = memo(() => {
const { files } = ev.dataTransfer;
const filePaths = Array.from(files).map(f => f.path);
+ // TODO https://github.com/electron/electron/issues/19920
+ // focusWindow();
+
if (filePaths.length === 1 && filePaths[0].toLowerCase().endsWith('.csv')) {
loadEdlFile(filePaths[0]);
return;