Skip to content

Commit f6668e8

Browse files
author
Rachel Macfarlane
committed
Close process explorer on cmd/ctrl+w, fixes microsoft#64373
1 parent 9f2ca57 commit f6668e8

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/vs/code/electron-browser/processExplorer/processExplorerMain.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { addDisposableListener } from 'vs/base/browser/dom';
1919
import { DisposableStore } from 'vs/base/common/lifecycle';
2020
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
2121

22-
2322
let mapPidToWindowTitle = new Map<number, string>();
2423

2524
const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/;
@@ -374,9 +373,20 @@ function requestProcessList(totalWaitTime: number): void {
374373
}, 200);
375374
}
376375

376+
function createCloseListener(): void {
377+
// Cmd/Ctrl + w closes process explorer
378+
window.addEventListener('keydown', e => {
379+
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
380+
if (cmdOrCtrlKey && e.keyCode === 87) {
381+
ipcRenderer.send('vscode:closeProcessExplorer');
382+
}
383+
});
384+
}
385+
377386
export function startup(data: ProcessExplorerData): void {
378387
applyStyles(data.styles);
379388
applyZoom(data.zoomLevel);
389+
createCloseListener();
380390

381391
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
382392
ipcRenderer.on('vscode:windowsInfoResponse', (_event: unknown, windows: any[]) => {

src/vs/platform/issue/electron-main/issueMainService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ export class IssueMainService implements IIssueService {
156156
}
157157
});
158158

159+
ipcMain.on('vscode:closeProcessExplorer', (event: IpcMainEvent) => {
160+
if (this._processExplorerWindow) {
161+
this._processExplorerWindow.close();
162+
}
163+
});
164+
159165
ipcMain.on('windowsInfoRequest', (event: IpcMainEvent) => {
160166
this.launchMainService.getMainProcessInfo().then(info => {
161167
event.sender.send('vscode:windowsInfoResponse', info.windows);

0 commit comments

Comments
 (0)