Skip to content

Option to disable Touch Bar controls and leave control strip (#38333) #40692

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

Merged
merged 4 commits into from
Dec 22, 2017
Merged
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
1 change: 1 addition & 0 deletions src/vs/platform/windows/common/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export interface IWindowSettings {
nativeTabs: boolean;
enableMenuBarMnemonics: boolean;
closeWhenEmpty: boolean;
touchbarEnabled: boolean;
}

export enum OpenContext {
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/electron-browser/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ export class ElectronWindow extends Themable {
return; // macOS only
}

const touchbarEnabled = this.configurationService.getValue<boolean>('keyboard.touchbar.enabled');
if (touchbarEnabled === false) {
return;
}

// Dispose old
this.touchBarDisposables = dispose(this.touchBarDisposables);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
interface IConfiguration extends IWindowsConfiguration {
update: { channel: string; };
telemetry: { enableCrashReporter: boolean };
keyboard: { touchbar: { enabled: boolean } };
}

export class SettingsChangeRelauncher implements IWorkbenchContribution {
Expand All @@ -34,6 +35,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
private nativeTabs: boolean;
private updateChannel: string;
private enableCrashReporter: boolean;
private touchbarEnabled: boolean;

private firstFolderResource: URI;
private extensionHostRestarter: RunOnceScheduler;
Expand Down Expand Up @@ -91,6 +93,12 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
changed = true;
}

// Touchbar config
if (config.keyboard && typeof config.keyboard.touchbar.enabled === 'boolean' && config.keyboard.touchbar.enabled !== this.touchbarEnabled) {
this.touchbarEnabled = config.keyboard.touchbar.enabled;
changed = true;
}

// Notify only when changed and we are the focused window (avoids notification spam across windows)
if (notify && changed) {
this.doConfirm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import { Extensions as ConfigExtensions, IConfigurationRegistry, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { onUnexpectedError } from 'vs/base/common/errors';
import { release } from 'os';

export class KeyboardMapperFactory {
public static readonly INSTANCE = new KeyboardMapperFactory();
Expand Down Expand Up @@ -583,6 +584,12 @@ const keyboardConfiguration: IConfigurationNode = {
'default': 'code',
'description': nls.localize('dispatch', "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."),
'included': OS === OperatingSystem.Macintosh || OS === OperatingSystem.Linux
},
'keyboard.touchbar.enabled': {
'type': 'boolean',
'default': true,
'description': nls.localize('window.touchbar.enabled', "Enables macOS tocuhbar buttons."),
'included': OS === OperatingSystem.Macintosh && parseFloat(release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
}
}
};
Expand Down