Skip to content

Instantly share code, notes, and snippets.

@jaanus
Created September 2, 2015 09:38
Show Gist options
  • Save jaanus/defb704cb43c718a0ffb to your computer and use it in GitHub Desktop.
Save jaanus/defb704cb43c718a0ffb to your computer and use it in GitHub Desktop.
Electron on Mac - patch for titleless look v2 (with toolbar)
jaanus@jaanus-imac ~/D/electron> git diff
diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm
index 64f7c11..357c305 100644
--- a/atom/browser/native_window_mac.mm
+++ b/atom/browser/native_window_mac.mm
@@ -352,7 +352,7 @@ NativeWindowMac::NativeWindowMac(
options.Get(switches::kStandardWindow, &useStandardWindow);
NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
- NSMiniaturizableWindowMask | NSResizableWindowMask;
+ NSMiniaturizableWindowMask | NSResizableWindowMask | NSFullSizeContentViewWindowMask | NSUnifiedTitleAndToolbarWindowMask;
if (!useStandardWindow || transparent() || !has_frame()) {
styleMask |= NSTexturedBackgroundWindowMask;
}
@@ -382,6 +382,14 @@ NativeWindowMac::NativeWindowMac(
// We will manage window's lifetime ourselves.
[window_ setReleasedWhenClosed:NO];
+ NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"wat"];
+ toolbar.showsBaselineSeparator = NO;
+ [window_ setToolbar:toolbar];
+
+ // Configure window look with hidden toolbar
+ [window_ setTitlebarAppearsTransparent:YES];
+ [window_ setTitleVisibility:NSWindowTitleHidden];
+
// On OS X the initial window size doesn't include window frame.
bool use_content_size = false;
options.Get(switches::kUseContentSize, &use_content_size);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment