summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-09-03 14:57:38 +0200
committerAndrej Mihajlov <and@mullvad.net>2019-09-03 14:57:38 +0200
commita60e7cd0250d80a25e8e1a2bd01ab701fe977701 (patch)
treeda04d06eeaf92f8533e9c5eb1700c5f471563b93 /gui/src/main
parent6e62c3c65bfe729b9ef2fe5b27721d429b1b2c7e (diff)
parent2e951404de676df143acac24785acbf3e07fff96 (diff)
downloadmullvadvpn-a60e7cd0250d80a25e8e1a2bd01ab701fe977701.tar.xz
mullvadvpn-a60e7cd0250d80a25e8e1a2bd01ab701fe977701.zip
Merge branch 'migrate-to-electron-6'
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/index.ts74
1 files changed, 45 insertions, 29 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 87d0de1d2e..efe76bdfab 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -371,6 +371,8 @@ class ApplicationMain {
case 'linux':
this.installGenericMenubarAppWindowHandlers(tray, windowController);
this.installLinuxWindowCloseHandler(windowController);
+ this.setLinuxAppMenu();
+ window.setMenuBarVisibility(false);
break;
default:
this.installGenericMenubarAppWindowHandlers(tray, windowController);
@@ -977,41 +979,44 @@ class ApplicationMain {
}
});
- ipcMain.on('collect-logs', (event: Electron.Event, requestId: string, toRedact: string[]) => {
- const reportPath = path.join(app.getPath('temp'), uuid.v4() + '.log');
- const executable = resolveBin('problem-report');
- const args = ['collect', '--output', reportPath];
- if (toRedact.length > 0) {
- args.push('--redact', ...toRedact);
- }
+ ipcMain.on(
+ 'collect-logs',
+ (event: Electron.IpcMainEvent, requestId: string, toRedact: string[]) => {
+ const reportPath = path.join(app.getPath('temp'), uuid.v4() + '.log');
+ const executable = resolveBin('problem-report');
+ const args = ['collect', '--output', reportPath];
+ if (toRedact.length > 0) {
+ args.push('--redact', ...toRedact);
+ }
- execFile(executable, args, { windowsHide: true }, (error, stdout, stderr) => {
- if (error) {
- log.error(
- `Failed to collect a problem report.
+ execFile(executable, args, { windowsHide: true }, (error, stdout, stderr) => {
+ if (error) {
+ log.error(
+ `Failed to collect a problem report.
Stdout: ${stdout.toString()}
Stderr: ${stderr.toString()}`,
- );
+ );
- event.sender.send('collect-logs-reply', requestId, {
- success: false,
- error: error.message,
- });
- } else {
- log.debug(`Problem report was written to ${reportPath}`);
+ event.sender.send('collect-logs-reply', requestId, {
+ success: false,
+ error: error.message,
+ });
+ } else {
+ log.debug(`Problem report was written to ${reportPath}`);
- event.sender.send('collect-logs-reply', requestId, {
- success: true,
- reportPath,
- });
- }
- });
- });
+ event.sender.send('collect-logs-reply', requestId, {
+ success: true,
+ reportPath,
+ });
+ }
+ });
+ },
+ );
ipcMain.on(
'send-problem-report',
(
- event: Electron.Event,
+ event: Electron.IpcMainEvent,
requestId: string,
email: string,
message: string,
@@ -1189,6 +1194,7 @@ class ApplicationMain {
frame: false,
webPreferences: {
nodeIntegration: true,
+ devTools: process.env.NODE_ENV === 'development',
},
};
@@ -1235,7 +1241,7 @@ class ApplicationMain {
private setMacOsAppMenu() {
const template: Electron.MenuItemConstructorOptions[] = [
{
- label: 'Mullvad',
+ label: 'Mullvad VPN',
submenu: [{ role: 'quit' }],
},
{
@@ -1245,20 +1251,30 @@ class ApplicationMain {
{ role: 'copy' },
{ role: 'paste' },
{ type: 'separator' },
- { role: 'selectall' },
+ { role: 'selectAll' },
],
},
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
}
+ private setLinuxAppMenu() {
+ const template: Electron.MenuItemConstructorOptions[] = [
+ {
+ label: 'Mullvad VPN',
+ submenu: [{ role: 'quit' }],
+ },
+ ];
+ Menu.setApplicationMenu(Menu.buildFromTemplate(template));
+ }
+
private addContextMenu(window: BrowserWindow) {
const menuTemplate: Electron.MenuItemConstructorOptions[] = [
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ type: 'separator' },
- { role: 'selectall' },
+ { role: 'selectAll' },
];
// add inspect element on right click menu