Skip to content

Commit 54b8f9f

Browse files
committed
Fix top bar visibility not picking up settings overrides (#6833)
* The header part was only reflecting user preference but not default settings overrides.
1 parent f0ec5f3 commit 54b8f9f

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

packages/application-extension/schema/top.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
"title": "Top Bar Visibility",
2323
"description": "Whether to show the top bar or not",
2424
"default": true
25+
},
26+
"adjustToScreen": {
27+
"type": "boolean",
28+
"title": "Automatic Top Bar Visibility",
29+
"description": "Whether to automatically adjust top bar visibility according to screen size, overriding above visible setting",
30+
"default": true
2531
}
2632
},
2733
"additionalProperties": false,

packages/application-extension/src/index.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,24 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
488488
isToggled: () => top.isVisible,
489489
});
490490

491-
let settingsOverride = false;
491+
let noAdjust = false;
492492

493493
if (settingRegistry) {
494494
const loadSettings = settingRegistry.load(pluginId);
495495
const updateSettings = (settings: ISettingRegistry.ISettings): void => {
496-
const visible = settings.get('visible').composite;
496+
// 'visible' property from user preferences or default settings
497+
let visible = settings.get('visible').composite;
497498
if (settings.user.visible !== undefined) {
498-
settingsOverride = true;
499-
top.setHidden(!visible);
499+
visible = settings.user.visible;
500+
}
501+
top.setHidden(!visible);
502+
// 'adjustToScreen' property from user preferences or default settings
503+
let adjustToScreen = settings.get('adjustToScreen').composite;
504+
if (settings.user.adjustToScreen !== undefined) {
505+
adjustToScreen = settings.user.adjustToScreen;
506+
}
507+
if (!adjustToScreen) {
508+
noAdjust = true;
500509
}
501510
};
502511

@@ -517,7 +526,7 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
517526
}
518527

519528
const onChanged = (): void => {
520-
if (settingsOverride) {
529+
if (noAdjust) {
521530
return;
522531
}
523532
if (app.format === 'desktop') {

0 commit comments

Comments
 (0)