Skip to content

Commit e9164ef

Browse files
committed
Revert "wco - hardcode devtools location on Linux (#227084)"
This reverts commit dfb96d1.
1 parent efab4bf commit e9164ef

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

src/vs/base/parts/sandbox/common/electronTypes.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,24 @@ export interface FileFilter {
217217
name: string;
218218
}
219219

220+
export interface OpenDevToolsOptions {
221+
/**
222+
* Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
223+
* `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
224+
* possible to dock back. In `detach` mode it's not.
225+
*/
226+
mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
227+
/**
228+
* Whether to bring the opened devtools window to the foreground. The default is
229+
* `true`.
230+
*/
231+
activate?: boolean;
232+
/**
233+
* A title for the DevTools window (only in `undocked` or `detach` mode).
234+
*/
235+
title?: string;
236+
}
237+
220238
interface InputEvent {
221239

222240
// Docs: https://electronjs.org/docs/api/structures/input-event

src/vs/platform/native/common/native.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { VSBuffer } from '../../../base/common/buffer.js';
77
import { Event } from '../../../base/common/event.js';
88
import { URI } from '../../../base/common/uri.js';
9-
import { MessageBoxOptions, MessageBoxReturnValue, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from '../../../base/parts/sandbox/common/electronTypes.js';
9+
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from '../../../base/parts/sandbox/common/electronTypes.js';
1010
import { ISerializableCommandAction } from '../../action/common/action.js';
1111
import { INativeOpenDialogOptions } from '../../dialogs/common/dialogs.js';
1212
import { createDecorator } from '../../instantiation/common/instantiation.js';
@@ -179,7 +179,7 @@ export interface ICommonNativeHostService {
179179
exit(code: number): Promise<void>;
180180

181181
// Development
182-
openDevTools(options?: INativeHostOptions): Promise<void>;
182+
openDevTools(options?: Partial<OpenDevToolsOptions> & INativeHostOptions): Promise<void>;
183183
toggleDevTools(options?: INativeHostOptions): Promise<void>;
184184

185185
// Perf Introspection

src/vs/platform/native/electron-main/nativeHostMainService.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as fs from 'fs';
77
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';
99
import { arch, cpus, freemem, loadavg, platform, release, totalmem, type } from 'os';
1010
import { promisify } from 'util';
1111
import { memoize } from '../../../base/common/decorators.js';
@@ -33,7 +33,7 @@ import { IProductService } from '../../product/common/productService.js';
3333
import { IPartsSplash } from '../../theme/common/themeService.js';
3434
import { IThemeMainService } from '../../theme/electron-main/themeMainService.js';
3535
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';
3737
import { IWindowsMainService, OpenContext } from '../../windows/electron-main/windows.js';
3838
import { isWorkspaceIdentifier, toWorkspaceIdentifier } from '../../workspace/common/workspace.js';
3939
import { IWorkspacesManagementMainService } from '../../workspaces/electron-main/workspacesManagementMainService.js';
@@ -859,28 +859,14 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
859859

860860
//#region Development
861861

862-
async openDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> {
862+
async openDevTools(windowId: number | undefined, options?: Partial<OpenDevToolsOptions> & INativeHostOptions): Promise<void> {
863863
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);
870865
}
871866

872867
async toggleDevTools(windowId: number | undefined, options?: INativeHostOptions): Promise<void> {
873868
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();
884870
}
885871

886872
//#endregion

src/vs/workbench/test/electron-sandbox/workbenchTestServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class TestNativeHostService implements INativeHostService {
143143
async closeWindow(): Promise<void> { }
144144
async quit(): Promise<void> { }
145145
async exit(code: number): Promise<void> { }
146-
async openDevTools(): Promise<void> { }
146+
async openDevTools(options?: Partial<Electron.OpenDevToolsOptions> & INativeHostOptions | undefined): Promise<void> { }
147147
async toggleDevTools(): Promise<void> { }
148148
async resolveProxy(url: string): Promise<string | undefined> { return undefined; }
149149
async lookupAuthorization(authInfo: AuthInfo): Promise<Credentials | undefined> { return undefined; }

0 commit comments

Comments
 (0)