Skip to content

Commit

Permalink
No csd linux by default (#68640)
Browse files Browse the repository at this point in the history
Revert the default custom title bar behavior on Linux
  • Loading branch information
sbatten authored Feb 18, 2019
1 parent 3134d9f commit d415060
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 35 deletions.
8 changes: 4 additions & 4 deletions src/vs/platform/windows/common/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Event } from 'vs/base/common/event';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
import { IProcessEnvironment, isMacintosh, isLinux } from 'vs/base/common/platform';
import { ParsedArgs, IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened } from 'vs/platform/history/common/history';
Expand Down Expand Up @@ -277,12 +277,12 @@ export function getTitleBarStyle(configurationService: IConfigurationService, en
}

const style = configuration.titleBarStyle;
if (style === 'native') {
return 'native';
if (style === 'native' || style === 'custom') {
return style;
}
}

return 'custom'; // default to custom on all OS
return isLinux ? 'native' : 'custom'; // default to custom on all macOS and Windows
}

export const enum OpenContext {
Expand Down
94 changes: 64 additions & 30 deletions src/vs/workbench/browser/parts/titlebar/menubarControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IAction, Action } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import * as DOM from 'vs/base/browser/dom';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { isMacintosh, isLinux } from 'vs/base/common/platform';
import { isMacintosh, isLinux, AccessibilitySupport } from 'vs/base/common/platform';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
Expand All @@ -32,6 +32,7 @@ import { MenuBar } from 'vs/base/browser/ui/menu/menubar';
import { SubmenuAction } from 'vs/base/browser/ui/menu/menu';
import { attachMenuStyler } from 'vs/platform/theme/common/styler';
import { assign } from 'vs/base/common/objects';
import { getAccessibilitySupport } from 'vs/base/browser/browser';

export class MenubarControl extends Disposable {

Expand Down Expand Up @@ -131,7 +132,9 @@ export class MenubarControl extends Disposable {
this.recentlyOpened = recentlyOpened;
});

this.detectAndRecommendCustomTitlebar();
this.notifyExistingLinuxUser();

this.notifyUserOfCustomMenubarAccessibility();

this.registerListeners();
}
Expand Down Expand Up @@ -191,8 +194,8 @@ export class MenubarControl extends Disposable {
this.updateMenubar();
}

if (event.affectsConfiguration('window.menuBarVisibility')) {
this.detectAndRecommendCustomTitlebar();
if (event.affectsConfiguration('editor.accessibilitySupport')) {
this.notifyUserOfCustomMenubarAccessibility();
}
}

Expand All @@ -203,39 +206,70 @@ export class MenubarControl extends Disposable {
});
}

private detectAndRecommendCustomTitlebar(): void {
// TODO@sbatten remove after feb19
private notifyExistingLinuxUser(): void {
if (!isLinux) {
return;
}

if (!this.storageService.getBoolean('menubar/electronFixRecommended', StorageScope.GLOBAL, false)) {
if (this.currentMenubarVisibility === 'hidden' || this.currentTitlebarStyleSetting === 'custom') {
// Issue will not arise for user, abort notification
return;
}
const isNewUser = !this.storageService.get('telemetry.lastSessionDate', StorageScope.GLOBAL);
const hasBeenNotified = this.storageService.getBoolean('menubar/linuxTitlebarRevertNotified', StorageScope.GLOBAL, false);
const titleBarConfiguration = this.configurationService.inspect('window.titleBarStyle');
const customShown = getTitleBarStyle(this.configurationService, this.environmentService) === 'custom';
if (isNewUser || hasBeenNotified || (titleBarConfiguration && titleBarConfiguration.user) || customShown) {
return;
}

const message = nls.localize('menubar.electronFixRecommendation', "If you experience hard to read text in the menu bar, we recommend trying out the custom title bar.");
this.notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('goToSetting', "Open Settings"),
run: () => {
return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' });
}
},
{
label: nls.localize('moreInfo', "More Info"),
run: () => {
window.open('https://go.microsoft.com/fwlink/?linkid=2038566');
}
},
{
label: nls.localize('neverShowAgain', "Don't Show Again"),
run: () => {
this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL);
}
const message = nls.localize('menubar.linuxTitlebarRevertNotification', "We have updated the default title bar on Linux to use the native setting. If you prefer, you can go back to the custom setting. More information is available in our [online documentation](https://go.microsoft.com/fwlink/?linkid=2074137).");
this.notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('goToSetting', "Open Settings"),
run: () => {
return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' });
}
},
{
label: nls.localize('neverShowAgain', "Don't Show Again"),
run: () => {
this.storageService.store('menubar/linuxTitlebarRevertNotified', true, StorageScope.GLOBAL);
}
]);
}
]);

this.storageService.store('menubar/linuxTitlebarRevertNotified', true, StorageScope.GLOBAL);
}

private notifyUserOfCustomMenubarAccessibility(): void {
if (isMacintosh) {
return;
}

const hasBeenNotified = this.storageService.getBoolean('menubar/accessibleMenubarNotified', StorageScope.GLOBAL, false);
const usingCustomMenubar = getTitleBarStyle(this.configurationService, this.environmentService) === 'custom';
const detected = getAccessibilitySupport() === AccessibilitySupport.Enabled;
const config = this.configurationService.getValue('editor.accessibilitySupport');

if (hasBeenNotified || usingCustomMenubar || !(config === 'on' || (config === 'auto' && detected))) {
return;
}

const message = nls.localize('menubar.customTitlebarAccessibilityNotification', "Accessibility support is enabled for you. For the most accessible experience, we recommend the custom title bar style.");
this.notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('goToSetting', "Open Settings"),
run: () => {
return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' });
}
},
{
label: nls.localize('neverShowAgain', "Don't Show Again"),
run: () => {
this.storageService.store('menubar/accessibleMenubarNotified', true, StorageScope.GLOBAL);
}
}
]);

this.storageService.store('menubar/accessibleMenubarNotified', true, StorageScope.GLOBAL);
}

private registerListeners(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ configurationRegistry.registerConfiguration({
'window.titleBarStyle': {
'type': 'string',
'enum': ['native', 'custom'],
'default': 'custom',
'default': isLinux ? 'native' : 'custom',
'scope': ConfigurationScope.APPLICATION,
'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
},
Expand Down

0 comments on commit d415060

Please sign in to comment.