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

macos: fix window.titleBarStyle on macOS #11584

Merged
merged 1 commit into from
Aug 25, 2022
Merged

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes: #11583

The commit fixes the handling when setting window.titleBarStyle to custom on macOS (which does not apply) as it has some negative side effects.

How to test

  1. start the application on macOS
  2. open the preferences-view
  3. search for titleBarStyle and change from native to custom
  4. the preference change will not take effect

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added bug bugs found in the application OS/Mac issues related to Mac OS labels Aug 18, 2022
@vince-fugnitto
Copy link
Member Author

@msujew I'd like to know your thoughts since I believe you made the initial change.

Should we apply the extra macOS handling at the preference level (and also benefit from not having to do a reload) or change the following line:

ipcMain.on(TitleBarStyleChanged, ({ sender }, titleBarStyle: string) => {
this.useNativeWindowFrame = titleBarStyle === 'native';

to

this.useNativeWindowFrame = isOSX || titleBarStyle === 'native';

@vince-fugnitto
Copy link
Member Author

We should also think of validating preference against included which seems to be ignored at the moment:

'window.titleBarStyle': {
type: 'string',
enum: ['native', 'custom'],
default: isWindows ? 'custom' : 'native',
scope: 'application',
// eslint-disable-next-line max-len
description: nls.localizeByDefault('Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.'),
included: !isOSX
},

@msujew
Copy link
Member

msujew commented Aug 18, 2022

Should we apply the extra macOS handling at the preference level (and also benefit from not having to do a reload) or change the following line:

@vince-fugnitto I believe we should also perform the proposed change in the ElectronMainApplication just to make absolutely sure that the window is never created without a frame. Keeping the current change would be preferable as well.

@vince-fugnitto
Copy link
Member Author

@msujew thank you for the feedback, I made the update and now handle it in both places 👍

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a Mac at hand, but the changes looks reasonable to me 👍

We should probably fix the included preference issue sometime.

The commit fixes the `window.titleBarStyle` handling on macOS which would otherwise cause the menu to be completely removed and difficult to recover for users.

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
@msujew
Copy link
Member

msujew commented Aug 24, 2022

@vince-fugnitto The latest change look better to me. I believe that we should be rather safe than sorry in this regard. Checking for isOSX seems perfectly reasonable.

@vince-fugnitto vince-fugnitto merged commit 8622c95 into master Aug 25, 2022
@vince-fugnitto vince-fugnitto deleted the vf/macos-titlebarstyle branch August 25, 2022 15:34
@github-actions github-actions bot added this to the 1.29.0 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application OS/Mac issues related to Mac OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macos: window.titleBarStyle removes top level menu
2 participants