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