|
5 | 5 |
|
6 | 6 | import * as fs from 'fs'; |
7 | 7 | import { exec } from 'child_process'; |
8 | | -import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell, webContents } from 'electron'; |
| 8 | +import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell, webContents } from 'electron'; |
9 | 9 | import { arch, cpus, freemem, loadavg, platform, release, totalmem, type } from 'os'; |
10 | 10 | import { promisify } from 'util'; |
11 | 11 | import { memoize } from '../../../base/common/decorators.js'; |
@@ -33,7 +33,7 @@ import { IProductService } from '../../product/common/productService.js'; |
33 | 33 | import { IPartsSplash } from '../../theme/common/themeService.js'; |
34 | 34 | import { IThemeMainService } from '../../theme/electron-main/themeMainService.js'; |
35 | 35 | import { ICodeWindow } from '../../window/electron-main/window.js'; |
36 | | -import { IColorScheme, IOpenedAuxiliaryWindow, IOpenedMainWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPoint, IRectangle, IWindowOpenable, useWindowControlsOverlay } from '../../window/common/window.js'; |
| 36 | +import { IColorScheme, IOpenedAuxiliaryWindow, IOpenedMainWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPoint, IRectangle, IWindowOpenable } from '../../window/common/window.js'; |
37 | 37 | import { IWindowsMainService, OpenContext } from '../../windows/electron-main/windows.js'; |
38 | 38 | import { isWorkspaceIdentifier, toWorkspaceIdentifier } from '../../workspace/common/workspace.js'; |
39 | 39 | import { IWorkspacesManagementMainService } from '../../workspaces/electron-main/workspacesManagementMainService.js'; |
@@ -859,28 +859,14 @@ export class NativeHostMainService extends Disposable implements INativeHostMain |
859 | 859 |
|
860 | 860 | //#region Development |
861 | 861 |
|
862 | | - async openDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> { |
| 862 | + async openDevTools(windowId: number | undefined, options?: Partial<OpenDevToolsOptions> & INativeHostOptions): Promise<void> { |
863 | 863 | const window = this.windowById(options?.targetWindowId, windowId); |
864 | | - |
865 | | - let mode: 'bottom' | undefined = undefined; |
866 | | - if (isLinux && useWindowControlsOverlay(this.configurationService)) { |
867 | | - mode = 'bottom'; // TODO@bpasero WCO and devtools collide with default option 'right' |
868 | | - } |
869 | | - window?.win?.webContents.openDevTools(mode ? { mode } : undefined); |
| 864 | + window?.win?.webContents.openDevTools(options?.mode ? { mode: options.mode, activate: options.activate } : undefined); |
870 | 865 | } |
871 | 866 |
|
872 | 867 | async toggleDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> { |
873 | 868 | const window = this.windowById(options?.targetWindowId, windowId); |
874 | | - const webContents = window?.win?.webContents; |
875 | | - if (!webContents) { |
876 | | - return; |
877 | | - } |
878 | | - |
879 | | - if (isLinux && useWindowControlsOverlay(this.configurationService) && !webContents.isDevToolsOpened()) { |
880 | | - webContents.openDevTools({ mode: 'bottom' }); // TODO@bpasero WCO and devtools collide with default option 'right' |
881 | | - } else { |
882 | | - webContents.toggleDevTools(); |
883 | | - } |
| 869 | + window?.win?.webContents.toggleDevTools(); |
884 | 870 | } |
885 | 871 |
|
886 | 872 | //#endregion |
|
0 commit comments