Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/vs/code/electron-main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ class CodeMain {

// Environment
const environmentMainService = new EnvironmentMainService(this.resolveArgs(), productService);

// Set custom application name for WM_CLASS/app_id when --class argument is provided
if (environmentMainService.args.class) {
app.setName(environmentMainService.args.class);
if (isLinux) {
app.setDesktopName(environmentMainService.args.class);
}
}

const instanceEnvironment = this.patchEnvironment(environmentMainService); // Patch `process.env` with the instance's environment
services.set(IEnvironmentMainService, environmentMainService);

Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/environment/common/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,5 @@ export interface NativeParsedArgs {
'trace-startup-file'?: string;
'trace-startup-duration'?: string;
'xdg-portal-required-version'?: string;
'class'?: string;
}
1 change: 1 addition & 0 deletions src/vs/platform/environment/node/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'waitMarkerFilePath': { type: 'string' },
'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") },
'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
'class': { type: 'string', cat: 'o', args: 'name', description: localize('class', "Sets the application class as used by window managers. This affects the WM_CLASS window property and allows window managers to apply specific rules to the window.") },
'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") },
'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },

Expand Down