summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/index.ts74
-rw-r--r--gui/src/renderer/components/CustomScrollbars.css2
-rw-r--r--gui/src/renderer/components/SettingsHeader.tsx2
-rw-r--r--gui/src/shared/ipc-event-channel.ts66
4 files changed, 83 insertions, 61 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
diff --git a/gui/src/renderer/components/CustomScrollbars.css b/gui/src/renderer/components/CustomScrollbars.css
index 8e5e2c9b11..0078cea857 100644
--- a/gui/src/renderer/components/CustomScrollbars.css
+++ b/gui/src/renderer/components/CustomScrollbars.css
@@ -2,11 +2,11 @@
display: flex;
flex-direction: column;
position: relative;
+ overflow: hidden;
}
.custom-scrollbars__scrollable {
width: 100%;
- height: 100%;
}
.custom-scrollbars__scrollable::-webkit-scrollbar {
diff --git a/gui/src/renderer/components/SettingsHeader.tsx b/gui/src/renderer/components/SettingsHeader.tsx
index 25b4990349..d7af1f9023 100644
--- a/gui/src/renderer/components/SettingsHeader.tsx
+++ b/gui/src/renderer/components/SettingsHeader.tsx
@@ -15,7 +15,7 @@ const styles = {
fontFamily: 'DINPro',
fontSize: 32,
fontWeight: '900',
- lineHeight: 32,
+ lineHeight: 36,
color: 'rgb(255, 255, 255)',
}),
subtitle: Styles.createTextStyle({
diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts
index f57368db2d..8283cf43dc 100644
--- a/gui/src/shared/ipc-event-channel.ts
+++ b/gui/src/shared/ipc-event-channel.ts
@@ -265,7 +265,7 @@ export class IpcRendererEventChannel {
export class IpcMainEventChannel {
public static state = {
handleGet(fn: () => IAppStateSnapshot) {
- ipcMain.on(GET_APP_STATE, (event: Electron.Event) => {
+ ipcMain.on(GET_APP_STATE, (event: Electron.IpcMainEvent) => {
event.returnValue = fn();
});
},
@@ -349,7 +349,7 @@ export class IpcMainEventChannel {
function listen<T>(event: string): (fn: (value: T) => void) => void {
return (fn: (value: T) => void) => {
- ipcRenderer.on(event, (_event: Electron.Event, newState: T) => fn(newState));
+ ipcRenderer.on(event, (_event: Electron.IpcRendererEvent, newState: T) => fn(newState));
};
}
@@ -381,7 +381,7 @@ function senderVoid(event: string): (webContents: WebContents) => void {
function handler<T>(event: string): (handlerFn: (value: T) => void) => void {
return (handlerFn: (value: T) => void) => {
- ipcMain.on(event, (_event: Electron.Event, newValue: T) => {
+ ipcMain.on(event, (_event: Electron.IpcMainEvent, newValue: T) => {
handlerFn(newValue);
});
};
@@ -391,26 +391,29 @@ type RequestResult<T> = { type: 'success'; value: T } | { type: 'error'; message
function requestHandler<T>(event: string): (fn: (...args: any[]) => Promise<T>) => void {
return (fn: (...args: any[]) => Promise<T>) => {
- ipcMain.on(event, async (ipcEvent: Electron.Event, requestId: string, ...args: any[]) => {
- const responseEvent = `${event}-${requestId}`;
- try {
- const result: RequestResult<T> = { type: 'success', value: await fn(...args) };
+ ipcMain.on(
+ event,
+ async (ipcEvent: Electron.IpcMainEvent, requestId: string, ...args: any[]) => {
+ const responseEvent = `${event}-${requestId}`;
+ try {
+ const result: RequestResult<T> = { type: 'success', value: await fn(...args) };
- if (ipcEvent.sender.isDestroyed()) {
- log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
- } else {
- ipcEvent.sender.send(responseEvent, result);
- }
- } catch (error) {
- const result: RequestResult<T> = { type: 'error', message: error.message || '' };
+ if (ipcEvent.sender.isDestroyed()) {
+ log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
+ } else {
+ ipcEvent.sender.send(responseEvent, result);
+ }
+ } catch (error) {
+ const result: RequestResult<T> = { type: 'error', message: error.message || '' };
- if (ipcEvent.sender.isDestroyed()) {
- log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
- } else {
- ipcEvent.sender.send(responseEvent, result);
+ if (ipcEvent.sender.isDestroyed()) {
+ log.debug(`Cannot send the reply for ${responseEvent} since the sender was destroyed.`);
+ } else {
+ ipcEvent.sender.send(responseEvent, result);
+ }
}
- }
- });
+ },
+ );
};
}
@@ -420,17 +423,20 @@ function requestSender<T>(event: string): (...args: any[]) => Promise<T> {
const requestId = uuid.v4();
const responseEvent = `${event}-${requestId}`;
- ipcRenderer.once(responseEvent, (_ipcEvent: Electron.Event, result: RequestResult<T>) => {
- switch (result.type) {
- case 'error':
- reject(new Error(result.message));
- break;
+ ipcRenderer.once(
+ responseEvent,
+ (_ipcEvent: Electron.IpcRendererEvent, result: RequestResult<T>) => {
+ switch (result.type) {
+ case 'error':
+ reject(new Error(result.message));
+ break;
- case 'success':
- resolve(result.value);
- break;
- }
- });
+ case 'success':
+ resolve(result.value);
+ break;
+ }
+ },
+ );
ipcRenderer.send(event, requestId, ...args);
});