diff --git a/atom/browser/native_window_mac.h b/atom/browser/native_window_mac.h index e3c5525b849b..6d36f99365e8 100644 --- a/atom/browser/native_window_mac.h +++ b/atom/browser/native_window_mac.h @@ -133,6 +133,9 @@ class NativeWindowMac : public NativeWindow, bool zoom_to_page_width() const { return zoom_to_page_width_; } + bool always_show_title_text_in_full_screen() const + { return always_show_title_text_in_full_screen_; } + protected: // Return a vector of non-draggable regions that fill a window of size // |width| by |height|, but leave gaps where the window should be draggable. @@ -177,6 +180,8 @@ class NativeWindowMac : public NativeWindow, bool zoom_to_page_width_; + bool always_show_title_text_in_full_screen_; + NSInteger attention_request_id_; // identifier from requestUserAttention // The presentation options before entering kiosk mode. diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index f46400ec0b02..1ec1e5bdc94f 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -340,11 +340,14 @@ bool ScopedDisableResize::disable_resize_ = false; // titlebar is expected to be empty, but after entering fullscreen mode we // have to set one, because title bar is visible here. NSWindow* window = shell_->GetNativeWindow(); + if ((shell_->transparent() || !shell_->has_frame()) && base::mac::IsAtLeastOS10_10() && // FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under // fullscreen mode. - shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) { + // Show title if always_show_title_text_in_full_screen flag is set + (shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET || + shell_->always_show_title_text_in_full_screen())) { [window setTitleVisibility:NSWindowTitleVisible]; } @@ -368,7 +371,8 @@ bool ScopedDisableResize::disable_resize_ = false; NSWindow* window = shell_->GetNativeWindow(); if ((shell_->transparent() || !shell_->has_frame()) && base::mac::IsAtLeastOS10_10() && - shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) { + (shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET || + shell_->always_show_title_text_in_full_screen())) { [window setTitleVisibility:NSWindowTitleHidden]; } @@ -798,6 +802,7 @@ NativeWindowMac::NativeWindowMac( is_kiosk_(false), was_fullscreen_(false), zoom_to_page_width_(false), + always_show_title_text_in_full_screen_(false), attention_request_id_(0), title_bar_style_(NORMAL) { int width = 800, height = 600; @@ -945,6 +950,8 @@ NativeWindowMac::NativeWindowMac( options.Get(options::kZoomToPageWidth, &zoom_to_page_width_); + options.Get(options::kAlwaysShowTitleTextInFullscreen, &always_show_title_text_in_full_screen_); + // Enable the NSView to accept first mouse event. bool acceptsFirstMouse = false; options.Get(options::kAcceptFirstMouse, &acceptsFirstMouse); diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index ce63fc716a3a..1ac320766393 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -48,6 +48,10 @@ const char kUseContentSize[] = "useContentSize"; // Whether window zoom should be to page width. const char kZoomToPageWidth[] = "zoomToPageWidth"; +// Whether always show title text in full screen is enabled. +const char kAlwaysShowTitleTextInFullscreen[] = +"alwaysShowTitleTextInFullscreen"; + // The requested title bar style for the window const char kTitleBarStyle[] = "titleBarStyle"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 6fda408ee5ce..997eb02018d1 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -35,6 +35,7 @@ extern const char kAlwaysOnTop[]; extern const char kAcceptFirstMouse[]; extern const char kUseContentSize[]; extern const char kZoomToPageWidth[]; +extern const char kAlwaysShowTitleTextInFullscreen[]; extern const char kTitleBarStyle[]; extern const char kTabbingIdentifier[]; extern const char kAutoHideMenuBar[]; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index baecffb53f63..7bc077023ddf 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -225,6 +225,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. display unless hovered over in the top left of the window. These custom buttons prevent issues with mouse events that occur with the standard window toolbar buttons. **Note:** This option is currently experimental. + * `alwaysShowTitleTextInFullscreen` Boolean (optional) - Shows the title in + tile bar in full screen mode on macOS with all `titleBarStyle` options. + Default is `false`. * `thickFrame` Boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard window frame. Setting it to `false` will remove window shadow and window animations. Default is `true`.