Skip to content

Commit

Permalink
Merge pull request #532 from mbektas/prevent_mainwindow_devtools
Browse files Browse the repository at this point in the history
disable devtools for mainwindow
  • Loading branch information
mbektas committed Dec 6, 2022
2 parents 6246e25 + 3c5f59b commit 8611946
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/dialog/themedwindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { BrowserWindow } from 'electron';
import * as fs from 'fs';
import * as path from 'path';
import { DarkThemeBGColor, LightThemeBGColor } from '../utils';

export class ThemedWindow {
constructor(options: ThemedWindow.IWindowOptions) {
Expand Down Expand Up @@ -75,15 +76,15 @@ export class ThemedWindow {
}
body {
margin: 0;
background: #ffffff;
background: ${LightThemeBGColor};
color: #000000;
font-size: var(--type-ramp-base-font-size);
font-family: var(--body-font);
-webkit-user-select: none;
user-select: none;
}
body.app-ui-dark {
background: #212121;
background: ${DarkThemeBGColor};
color: #ffffff;
}
.page-container {
Expand Down
14 changes: 12 additions & 2 deletions src/main/mainwindow/mainwindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import { BrowserWindow } from 'electron';
import { LabView } from '../labview/labview';
import { TitleBarView } from '../titlebarview/titlebarview';
import { appConfig, isDarkTheme } from '../utils';
import {
appConfig,
DarkThemeBGColor,
isDarkTheme,
LightThemeBGColor
} from '../utils';

export class MainWindow {
constructor(options: MainWindow.IOptions) {
Expand All @@ -21,7 +26,12 @@ export class MainWindow {
title: 'JupyterLab',
titleBarStyle: 'hidden',
frame: process.platform === 'darwin',
backgroundColor: isDarkTheme(appConfig.theme) ? '#212121' : '#ffffff'
backgroundColor: isDarkTheme(appConfig.theme)
? DarkThemeBGColor
: LightThemeBGColor,
webPreferences: {
devTools: false
}
});

this._window.setMenuBarVisibility(false);
Expand Down
3 changes: 3 additions & 0 deletions src/main/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import log from 'electron-log';
import { app, nativeTheme } from 'electron';
import { IPythonEnvironment } from './tokens';

export const DarkThemeBGColor = '#212121';
export const LightThemeBGColor = '#ffffff';

export interface IAppConfiguration {
isRemote: boolean;
url: URL;
Expand Down

0 comments on commit 8611946

Please sign in to comment.