Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add notification for linux issue #62683

Merged
merged 6 commits into from
Nov 7, 2018
Merged
Changes from 1 commit
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
50 changes: 47 additions & 3 deletions src/vs/workbench/browser/parts/titlebar/menubarControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.$;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -167,6 +171,8 @@ export class MenubarControl extends Disposable {
this.recentlyOpened = recentlyOpened;
});

this.detectAndRecommendCustomTitlebar();

this.registerListeners();
}

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

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

Expand Down Expand Up @@ -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.');
sbatten marked this conversation as resolved.
Show resolved Hide resolved
this.notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('tryIt', 'Try it'),
sbatten marked this conversation as resolved.
Show resolved Hide resolved
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');
sbatten marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
label: nls.localize('neverShowAgain', 'Don\'t Show Again'),
sbatten marked this conversation as resolved.
Show resolved Hide resolved
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