homebrew-emacs-plus
homebrew-emacs-plus copied to clipboard
Rounded corners when no title bar
When using the no title bar option, I noticed that the frame does not have rounded corners anymore. After trying to understand why it was the case, I think the mask of the window should be something like NSWindowStyleMaskFullSizeContentView and the NSWindowTitleVisibility should be set to hidden. However, I'm not sure how this should be combined the the current no-title-bar patch.
Relevant links:
- https://github.com/lukakerr/NSWindowStyles
- https://stackoverflow.com/questions/35944792/window-title-bar-appears-transparent-issue-not-really-transparent
- https://gitlab.com/gnachman/iterm2/-/issues/7143
Hey @rougier
Nice investigation. You are totally right that the reason is NSWindowStyles
used by this patch.
However, I'm not sure how this should be combined the the current no-title-bar patch.
Ineeded. I don't like this patch for not being composable nor configurable. Ideally this patch should not change NSWindowStyle
, but instead provide a variable controlling NSWindowStyle
and this variable should be configurable from init.el
.
That would be awesome (and well beyond my knowledge of Apple internals)
I agree with not combining it with the current no-title-bar behavior out of pure self-interest. I use this patch with a tiling window manager, and it would bug me to see my desktop through the space left by rounded corners. I could see someone else curating a desktop that is meant to show through the rounded corners, but that's not me. So long as the behavior of the --no-title-bar
flag in brew remains unchanged, I'm happy, and I'd be fine with needing to use a different flag, but having the default just change would be slightly annoying to me. I'd still be fine with it, just very low-key annoyed.
Maybe there could be an additional flag --with-round-corners
or --no-round-corners
.
I'm using this patch, without title bar and keep the rounded corners, works very well:
diff --git a/src/nsterm.m b/src/nsterm.m
index aa29c13eb2..6cec091b8e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -434,6 +434,7 @@ - (NSColor *)colorUsingDefaultColorSpace
/* These flags will be OR'd or XOR'd with the NSWindow's styleMask
property depending on what we're doing. */
#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \
+ | NSFullSizeContentViewWindowMask \
| NSWindowStyleMaskResizable \
| NSWindowStyleMaskMiniaturizable \
| NSWindowStyleMaskClosable)
@@ -8342,6 +8343,12 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f
#endif
}
+ [self setTitlebarAppearsTransparent:YES];
+ [self setTitleVisibility:NSWindowTitleHidden];
+ [[self standardWindowButton:NSWindowCloseButton] setHidden:YES];
+ [[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
+ [[self standardWindowButton:NSWindowZoomButton] setHidden:YES];
+
return self;
}
@cxa is there a way to apply this patch to emacs-plus?
@cxa is there a way to apply this patch to emacs-plus?
You can clone my fork and run ./build 28 --with-no-titlebar-alt
. (since I only tested on Emacs 28)
@cxa works like a charm! thanks
For someone who needs no titlebar with rounded corners for 29, you can check out my fork: https://github.com/cxa/homebrew-emacs-plus/blob/master/Formula/emacs-plus%4029.rb
I second @rougier's suggestion of two flags, out of self interest... now that Yabai defaults to rounded window borders. EDIT apologies looks like @brorbw beat me to it.
Im a bit opposed to two flags. Since all alle macOS apps more or less have rounded corners I think it should be the default. Thats just my two cents
I think for Emacs 28 we should have two options as changing from rectangle to round is a breaking change. So a pair of --with-no-title-bar
and --with-no-title-bar-rounded
sounds good to me. For Emacs 29 we will have only one option, --with-no-title-bar-rounded
as the rectangle is available without any patches - it's just a matter of configuration.
I invite everyone interested in it to join #511 to share your opinion on naming. I am definitely bad at it (just take a look at the repository name :sweat_smile: ).
Thanks to @brorbw , emacs-plus@28
now has the option --with-no-titlebar-and-round-corners
that uses patch by @cxa. Soon it will be added to emacs-plus@29
.
CC @rougier
P.S. @cxa and @brorbw what I've noticed, unlike --with-no-titlebar
, --with-no-titlebar-and-round-corners
doesn't disable tool-bar
. That means, unless user modifies configurations, tool-bar
overlays buffer content.
@d12frosted I got a little confused by that because I have not disabled the toolbar in my config. So I did some digging and indeed found this inside doom
(setq menu-bar-mode nil
tool-bar-mode nil
scroll-bar-mode nil)
@brorbw removed it in #514. So even with 'stock' Emacs configurations you get no visual bugs.
Added support of rounded corners to Emacs 29 in #516. I am going to merge it tomorrow, unless someone has objections or suggestions.
Instead of compilation options, all you have to do is to add the following line to your early-init.el
:
(add-to-list 'default-frame-alist '(undecorated-round . t))
Make sure that you don't have undecorated
option as they are mutually exclusive.
early-init.el |
|
---|---|
decorated | |
undecorated with square corners | (undecorated . t) |
undecorated with round corners | (undecorated-round . t) |
@d12frosted I am using (add-to-list 'default-frame-alist '(undecorated . t))
but (add-to-list 'default-frame-alist '(fullscreen . maximized))
stopped working with it.
I usually made the emacs frame maximised to the screen.
@ankitsharma07 is it on #516 or from master?
Solution for Emacs 29 is also in the master, so closing this FR. Let me know if you think there is something else to do.
Nice, now I can drop my fork.