diff --git a/js/views/settings_view.js b/js/views/settings_view.js index 58818531e..e17304a29 100644 --- a/js/views/settings_view.js +++ b/js/views/settings_view.js @@ -106,12 +106,14 @@ value: window.initialData.spellCheck, setFn: window.setSpellCheck, }); - new CheckboxView({ - el: this.$('.menu-bar-setting'), - name: 'menu-bar-setting', - value: window.initialData.hideMenuBar, - setFn: window.setHideMenuBar, - }); + if (Settings.isHideMenuBarSupported()) { + new CheckboxView({ + el: this.$('.menu-bar-setting'), + name: 'menu-bar-setting', + value: window.initialData.hideMenuBar, + setFn: window.setHideMenuBar, + }); + } new MediaPermissionsSettingView({ el: this.$('.media-permissions'), value: window.initialData.mediaPermissions, @@ -140,6 +142,7 @@ nameOnly: i18n('nameOnly'), audioNotificationDescription: i18n('audioNotificationDescription'), isAudioNotificationSupported: Settings.isAudioNotificationSupported(), + isHideMenuBarSupported: Settings.isHideMenuBarSupported(), themeLight: i18n('themeLight'), themeDark: i18n('themeDark'), hideMenuBar: i18n('hideMenuBar'), diff --git a/settings.html b/settings.html index f74ccb555..bf14f2444 100644 --- a/settings.html +++ b/settings.html @@ -54,10 +54,12 @@
+ {{ #isHideMenuBarSupported }} + {{ /isHideMenuBarSupported }}

{{ notifications }}

diff --git a/ts/test/types/Settings_test.ts b/ts/test/types/Settings_test.ts index d54f9107b..714b1342e 100644 --- a/ts/test/types/Settings_test.ts +++ b/ts/test/types/Settings_test.ts @@ -130,4 +130,65 @@ describe('Settings', () => { }); }); }); + describe('isHideMenuBarSupported', () => { + context('on macOS', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('darwin'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return false', () => { + assert.isFalse(Settings.isHideMenuBarSupported()); + }); + }); + + context('on Windows', () => { + context('version 7', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('win32'); + sandbox.stub(os, 'release').returns('7.0.0'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return true', () => { + assert.isTrue(Settings.isHideMenuBarSupported()); + }); + }); + + context('version 8+', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('win32'); + sandbox.stub(os, 'release').returns('8.0.0'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return true', () => { + assert.isTrue(Settings.isHideMenuBarSupported()); + }); + }); + }); + + context('on Linux', () => { + beforeEach(() => { + sandbox.stub(process, 'platform').value('linux'); + }); + + afterEach(() => { + sandbox.restore(); + }); + + it('should return true', () => { + assert.isTrue(Settings.isHideMenuBarSupported()); + }); + }); + }); }); diff --git a/ts/types/Settings.ts b/ts/types/Settings.ts index 737fad3d3..5231bdf0f 100644 --- a/ts/types/Settings.ts +++ b/ts/types/Settings.ts @@ -9,3 +9,6 @@ export const isAudioNotificationSupported = () => // https://github.com/electron/electron/issues/11189 export const isNotificationGroupingSupported = () => !OS.isWindows() || OS.isWindows(MIN_WINDOWS_VERSION); + +// the "hide menu bar" option is specific to Windows and Linux +export const isHideMenuBarSupported = () => !OS.isMacOS();