From bf25b0c9383f2ba0b94a96a604ff7a70733afb2e Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 14:17:47 -0800 Subject: [PATCH 1/6] add notification for linux issue --- .../browser/parts/titlebar/menubarControl.ts | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 2c45c9136519d..3c866080b4254 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -15,11 +15,11 @@ import { ActionRunner, IActionRunner, IAction, Action } from 'vs/base/common/act 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 } from 'vs/base/common/platform'; +import { isMacintosh, isLinux } from 'vs/base/common/platform'; import { Menu, IMenuOptions, SubmenuAction, MENU_MNEMONIC_REGEX, cleanMnemonic, MENU_ESCAPED_MNEMONIC_REGEX } from 'vs/base/browser/ui/menu/menu'; import { KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; -import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationChangeEvent, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { Event, Emitter } from 'vs/base/common/event'; import { IDisposable, Disposable, dispose } from 'vs/base/common/lifecycle'; import { domEvent } from 'vs/base/browser/event'; @@ -32,6 +32,8 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { IUpdateService, StateType } from 'vs/platform/update/common/update'; import { Gesture, EventType, GestureEvent } from 'vs/base/browser/touch'; import { attachMenuStyler } from 'vs/platform/theme/common/styler'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; const $ = DOM.$; @@ -124,7 +126,9 @@ export class MenubarControl extends Disposable { @IKeybindingService private keybindingService: IKeybindingService, @IConfigurationService private configurationService: IConfigurationService, @ILabelService private labelService: ILabelService, - @IUpdateService private updateService: IUpdateService + @IUpdateService private updateService: IUpdateService, + @IStorageService private storageService: IStorageService, + @INotificationService private notificationService: INotificationService ) { super(); @@ -167,6 +171,8 @@ export class MenubarControl extends Disposable { this.recentlyOpened = recentlyOpened; }); + this.detectAndRecommendCustomTitlebar(); + this.registerListeners(); } @@ -348,6 +354,7 @@ export class MenubarControl extends Disposable { if (event.affectsConfiguration('window.menuBarVisibility')) { this.setUnfocusedState(); + this.detectAndRecommendCustomTitlebar(); } } @@ -436,6 +443,43 @@ export class MenubarControl extends Disposable { }); } + private detectAndRecommendCustomTitlebar(): 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 message = nls.localize('menubar.electronFixRecommendation', 'If you experience a low-contrast issue with the menu bar, we recommend trying out the custom title bar.'); + this.notificationService.prompt(Severity.Info, message, [ + { + label: nls.localize('tryIt', 'Try it'), + run: () => { + // Don't recommend this again + this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL); + return this.configurationService.updateValue('window.titleBarStyle', 'custom', ConfigurationTarget.USER); + } + }, + { + label: nls.localize('moreInfo', 'More info'), + run: () => { + window.open('https://github.com/Microsoft/vscode/issues/62593'); + } + }, + { + label: nls.localize('neverShowAgain', 'Don\'t Show Again'), + run: () => { + this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL); + } + } + ]); + } + } + private registerListeners(): void { // Update when config changes this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e))); From a8ee9709a1b7728aae24eb5a613092edfe105b54 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 14:34:34 -0800 Subject: [PATCH 2/6] update wording for clarity --- src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 3c866080b4254..a38c067b457fd 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -454,7 +454,7 @@ export class MenubarControl extends Disposable { return; } - const message = nls.localize('menubar.electronFixRecommendation', 'If you experience a low-contrast issue with the menu bar, we recommend trying out the custom title bar.'); + 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('tryIt', 'Try it'), From 680b6a43825dda78aaa680287acc0d20c95770d7 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 14:36:02 -0800 Subject: [PATCH 3/6] double quotes on localized strings --- src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index a38c067b457fd..3406e719cad65 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -454,10 +454,10 @@ export class MenubarControl extends Disposable { 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.'); + 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('tryIt', 'Try it'), + label: nls.localize('tryIt', "Try it"), run: () => { // Don't recommend this again this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL); @@ -465,13 +465,13 @@ export class MenubarControl extends Disposable { } }, { - label: nls.localize('moreInfo', 'More info'), + label: nls.localize('moreInfo', "More info"), run: () => { window.open('https://github.com/Microsoft/vscode/issues/62593'); } }, { - label: nls.localize('neverShowAgain', 'Don\'t Show Again'), + label: nls.localize('neverShowAgain', "Don't Show Again"), run: () => { this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL); } From f9fb6dcf6b906ec0279b66ab6baa4e87c3c3a3fe Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 14:54:32 -0800 Subject: [PATCH 4/6] use fwlink --- src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 3406e719cad65..15184a3b39b4d 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -467,7 +467,7 @@ export class MenubarControl extends Disposable { { label: nls.localize('moreInfo', "More info"), run: () => { - window.open('https://github.com/Microsoft/vscode/issues/62593'); + window.open('https://go.microsoft.com/fwlink/?linkid=2038566'); } }, { From ec09b9a2449d02a284cef952ecc08dbda1e4f63a Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 15:02:42 -0800 Subject: [PATCH 5/6] open settings editor instead --- .../workbench/browser/parts/titlebar/menubarControl.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 15184a3b39b4d..a02497e8a2dce 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -19,7 +19,7 @@ import { isMacintosh, isLinux } from 'vs/base/common/platform'; import { Menu, IMenuOptions, SubmenuAction, MENU_MNEMONIC_REGEX, cleanMnemonic, MENU_ESCAPED_MNEMONIC_REGEX } from 'vs/base/browser/ui/menu/menu'; import { KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; -import { IConfigurationService, IConfigurationChangeEvent, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; import { Event, Emitter } from 'vs/base/common/event'; import { IDisposable, Disposable, dispose } from 'vs/base/common/lifecycle'; import { domEvent } from 'vs/base/browser/event'; @@ -34,6 +34,7 @@ import { Gesture, EventType, GestureEvent } from 'vs/base/browser/touch'; import { attachMenuStyler } from 'vs/platform/theme/common/styler'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; +import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; const $ = DOM.$; @@ -128,7 +129,8 @@ export class MenubarControl extends Disposable { @ILabelService private labelService: ILabelService, @IUpdateService private updateService: IUpdateService, @IStorageService private storageService: IStorageService, - @INotificationService private notificationService: INotificationService + @INotificationService private notificationService: INotificationService, + @IPreferencesService private preferencesService: IPreferencesService ) { super(); @@ -459,9 +461,7 @@ export class MenubarControl extends Disposable { { label: nls.localize('tryIt', "Try it"), run: () => { - // Don't recommend this again - this.storageService.store('menubar/electronFixRecommended', true, StorageScope.GLOBAL); - return this.configurationService.updateValue('window.titleBarStyle', 'custom', ConfigurationTarget.USER); + return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' }); } }, { From df3e1217c0ae021b3b33f104a1764a803b4ea571 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 6 Nov 2018 15:15:54 -0800 Subject: [PATCH 6/6] title casing and wording fix --- src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index a02497e8a2dce..b7ca7da0ba45d 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -459,13 +459,13 @@ export class MenubarControl extends Disposable { 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('tryIt', "Try it"), + label: nls.localize('goToSetting', "Open Settings"), run: () => { return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' }); } }, { - label: nls.localize('moreInfo', "More info"), + label: nls.localize('moreInfo', "More Info"), run: () => { window.open('https://go.microsoft.com/fwlink/?linkid=2038566'); }