diff --git a/package.json b/package.json index 2a9d974..cd5a226 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "devDependencies": { "electron": "^32.2.0", "electron-builder": "^25.1.8", - "electron-webpack": "^2.8.2", "electron-builder-squirrel-windows": "^25.1.8", + "electron-webpack": "^2.8.2", "webpack": "^4.47.0" }, "name": "Deepl-Linux-Electron", - "version": "1.5.0", + "version": "1.6.0", "scripts": { "dev": "electron-webpack dev", "compile": "electron-webpack", @@ -21,6 +21,7 @@ }, "license": "MIT", "dependencies": { + "@electron/remote": "^2.1.2", "electron-store": "^8.2.0", "source-map-support": "^0.5.19" } diff --git a/src/main/index.js b/src/main/index.js index aa0f3a5..a126e1c 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -26,6 +26,7 @@ const { Tray, clipboard } = require('electron'); +require('@electron/remote/main').initialize(); var win = null; var appQuitting = false; const appName = 'Deepl-Linux-Electron'; @@ -39,6 +40,7 @@ app.setAboutPanelOptions({ app.on('ready', function() { let Menu = require('electron').Menu; + //console.log(app.getPath('userData')); isRemoveLineBreaks = store.get('remove_line_breaks'); isHiddenOnStartup = store.get('hidden_on_startup'); windowWidth = store.get('window_width'); @@ -54,10 +56,12 @@ app.on('ready', function() { width: 280, webPreferences: { nodeIntegration: true, - enableRemoteModule: true // https://github.com/electron/electron/issues/16558#issuecomment-703143446 + enableRemoteModule: true, + preload: path.join(__static, 'hotkey.js') } }) - // hotkeySettingsWindow.webContents.openDevTools(); + // hotkeySettingsWindow.webContents.openDevTools(); + require('@electron/remote/main').enable(hotkeySettingsWindow.webContents) hotkeySettingsWindow.loadFile(path.join(__static, 'hotkey.html')) } @@ -70,9 +74,11 @@ app.on('ready', function() { width: 200, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + preload: path.join(__static, 'window-size.js') } }) + require('@electron/remote/main').enable(settingsWindowSize.webContents) settingsWindowSize.loadFile(path.join(__static, 'window-size.html')) } }, { @@ -143,9 +149,11 @@ app.on('ready', function() { title: "Deepl-Linux-Electron", width: 800, height: 600, - //webPreferences: { - // preload: path.join(__static, 'preload.js') - //}, + webPreferences: { + nodeIntegration: true, + enableRemoteModule: true + //preload: path.join(__static, 'preload.js') + }, show: !isHiddenOnStartup }); diff --git a/static/hotkey.html b/static/hotkey.html index e5f23ce..172fec4 100644 --- a/static/hotkey.html +++ b/static/hotkey.html @@ -7,57 +7,9 @@