1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 18:32:34 +01:00

implement focus on drop #335

(not working yet)
This commit is contained in:
Mikael Finstad 2020-05-03 18:41:41 +08:00
parent 8c687978d5
commit 77da0299f0
2 changed files with 13 additions and 1 deletions

View File

@ -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 };

View File

@ -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;