Skip to content

feat: Support modifier-click opening files and folders in a new window#325228

Open
cnyyc1024 wants to merge 1 commit into
microsoft:mainfrom
cnyyc1024:open-file-or-folder-with-modifier-in-new-window
Open

feat: Support modifier-click opening files and folders in a new window#325228
cnyyc1024 wants to merge 1 commit into
microsoft:mainfrom
cnyyc1024:open-file-or-folder-with-modifier-in-new-window

Conversation

@cnyyc1024

Copy link
Copy Markdown

Fixes #325225

This adds modifier-click support for File menu open actions so users can open files and folders in a new window without adding new visible menu items.

The implementation reuses the existing *InNewWindow commands:

  • workbench.action.files.openFileFolderInNewWindow
  • workbench.action.files.openFolderInNewWindow

It handles both menu paths:

  • native menubar / fallback menu handling
  • custom renderer menubar

How to test:

  1. Open VS Code with the custom menubar enabled.
  2. Hold Ctrl or Shift on Windows/Linux.
  3. Click File > Open Folder....
  4. Select a folder.
  5. Verify the folder opens in a new window.
  6. Verify normal clicking File > Open Folder... still opens with the existing behavior.

On macOS, use Cmd or Option instead.

Validation:

  • npm run typecheck-client
  • npm run precommit

Copilot AI review requested due to automatic review settings July 10, 2026 02:11
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@benibenj

Matched files:

  • src/vs/workbench/browser/parts/titlebar/menubarControl.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds modifier-click handling to open File-menu resources in a new window.

Changes:

  • Detects platform-specific modifier clicks.
  • Redirects supported open actions to existing new-window commands.
  • Covers custom and native menubars.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
menubarControl.ts Handles modifier clicks in the custom menubar.
menubar.ts Handles modifier clicks in the native menubar.

Comment on lines +393 to +399
switch (commandId) {
case 'workbench.action.files.openFileFolder':
return 'workbench.action.files.openFileFolderInNewWindow';
case 'workbench.action.files.openFolder':
return 'workbench.action.files.openFolderInNewWindow';
default:
return commandId;
Comment on lines +594 to +600
switch (commandId) {
case 'workbench.action.files.openFileFolder':
return 'workbench.action.files.openFileFolderInNewWindow';
case 'workbench.action.files.openFolder':
return 'workbench.action.files.openFolderInNewWindow';
default:
return commandId;
@cnyyc1024

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open files, folders in a new window with modifier-click from the File menu

4 participants