Skip to content

Commit

Permalink
add notification for linux issue (#62683)
Browse files Browse the repository at this point in the history
* add notification for linux issue

* update wording for clarity

* double quotes on localized strings

* use fwlink

* open settings editor instead

* title casing and wording fix
  • Loading branch information
sbatten committed Nov 7, 2018
1 parent 1d0e429 commit 555910c
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions src/vs/workbench/browser/parts/titlebar/menubarControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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';
Expand All @@ -32,6 +32,9 @@ 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';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';

const $ = DOM.$;

Expand Down Expand Up @@ -124,7 +127,10 @@ 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,
@IPreferencesService private preferencesService: IPreferencesService
) {

super();
Expand Down Expand Up @@ -167,6 +173,8 @@ export class MenubarControl extends Disposable {
this.recentlyOpened = recentlyOpened;
});

this.detectAndRecommendCustomTitlebar();

this.registerListeners();
}

Expand Down Expand Up @@ -348,6 +356,7 @@ export class MenubarControl extends Disposable {

if (event.affectsConfiguration('window.menuBarVisibility')) {
this.setUnfocusedState();
this.detectAndRecommendCustomTitlebar();
}
}

Expand Down Expand Up @@ -436,6 +445,41 @@ 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 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);
}
}
]);
}
}

private registerListeners(): void {
// Update when config changes
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
Expand Down

0 comments on commit 555910c

Please sign in to comment.