提交 3ceb1b99 编写于 作者: M Marcus Noble 提交者: Benjamin Pasero

Add setting to make touchbar controls optional (#70174)

* Add setting to make touchbar controls optional

* fix bad merge

* fix unneccessary change

* 💄

* fix
上级 ab60600e
......@@ -213,6 +213,8 @@ export class ElectronWindow extends Disposable {
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('window.zoomLevel')) {
this.updateWindowZoomLevel();
} else if (e.affectsConfiguration('keyboard.touchbar.ignored')) {
this.updateTouchbarMenu();
}
}));
......@@ -372,10 +374,15 @@ export class ElectronWindow extends Disposable {
// Convert into command action multi array
const items: ICommandAction[][] = [];
let group: ICommandAction[] = [];
const ignoredItems = this.configurationService.getValue<string[]>('keyboard.touchbar.ignored') || [];
for (const action of actions) {
// Command
if (action instanceof MenuItemAction) {
if (ignoredItems.indexOf(action.item.id) >= 0) {
continue; // ignored
}
group.push(action.item);
}
......
......@@ -725,7 +725,6 @@ const keyboardConfiguration: IConfigurationNode = {
'markdownDescription': nls.localize('dispatch', "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."),
'included': OS === OperatingSystem.Macintosh || OS === OperatingSystem.Linux
}
// no touch bar support
}
};
......
......@@ -22,8 +22,17 @@ const keyboardConfiguration: IConfigurationNode = {
'default': true,
'description': nls.localize('touchbar.enabled', "Enables the macOS touchbar buttons on the keyboard if available."),
'included': OS === OperatingSystem.Macintosh && parseFloat(release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
},
'keyboard.touchbar.ignored': {
'type': 'array',
'items': {
'type': 'string'
},
'default': [],
'description': nls.localize('touchbar.ignored', 'A set of identifiers for entries in the touchbar that should not show up (for example `workbench.action.navigateBack`.'),
'included': OS === OperatingSystem.Macintosh && parseFloat(release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
}
}
};
configurationRegistry.registerConfiguration(keyboardConfiguration);
\ No newline at end of file
configurationRegistry.registerConfiguration(keyboardConfiguration);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册