Close process explorer on cmd/ctrl+w, fixes #64373

This commit is contained in:
Rachel Macfarlane
2019-10-14 11:59:45 -07:00
parent 9f2ca57b05
commit f6668e808a
2 changed files with 17 additions and 1 deletions

View File

@@ -19,7 +19,6 @@ import { addDisposableListener } from 'vs/base/browser/dom';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
let mapPidToWindowTitle = new Map<number, string>();
const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/;
@@ -374,9 +373,20 @@ function requestProcessList(totalWaitTime: number): void {
}, 200);
}
function createCloseListener(): void {
// Cmd/Ctrl + w closes process explorer
window.addEventListener('keydown', e => {
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
if (cmdOrCtrlKey && e.keyCode === 87) {
ipcRenderer.send('vscode:closeProcessExplorer');
}
});
}
export function startup(data: ProcessExplorerData): void {
applyStyles(data.styles);
applyZoom(data.zoomLevel);
createCloseListener();
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
ipcRenderer.on('vscode:windowsInfoResponse', (_event: unknown, windows: any[]) => {