Subject: Re: bug#58917: 28.2; Arm Build on Mac OS Monterey: Buffer Name is on the same line as Tool Bar Icons

From: Stefan Kangas <[email-masked]>
Date: Sat, 12 Nov 2022 20:11:23 -0800

Po Lu <[email-masked]> writes:

> Oliver Yang <[email-masked]> writes:
>
>> Same problem described in the thread
>> https://emacs.stackexchange.com/questions/64602/buffer-name-on-separate-row-from-toolbar-icons
>>
>> The Arm Build of emacs on Mac OS 12.6 will have buffer name on the same
>> line as the toolbar icons.  This is not case with X86 version of 28.2 on
>> Mac OS 12.6.
>>
>>
>> In GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build 21A559))
>> of 2022-09-12 built on armbob.lan
>> Windowing system distributor 'Apple', version 10.3.2113
>> System Description:  macOS 12.6
>
> As usual, with Apple, this depends on what system you built Emacs on.
>
> So my guess is you built the build exhibiting the new tool bar placement
> on Mac OS 12, and the build that does not on some older version of Mac
> OS.  There is nothing that we Emacs developers can do about this, I
> think.

The linked thread suggests some solutions:

    It looks like you can change the default setting for whether or not
    the title (for Emacs, it's the buffer name) is over the toolbar with

        defaults write -g NSWindowSupportsAutomaticInlineTitle -bool false

    [...]

    I think that something like the following code change to Emacs in
    the right place would change the default appearance always:

    if ( [NSToolbar instancesRespondToSelector:@selector(setToolbarStyle:)])
        [win setToolbarStyle: NSWindowToolbarStyleExpanded];

    for an NSWindow object win at an appropriate time.

There is also a link to:

    https://apple.stackexchange.com/questions/408475/revert-ui-on-big-sur

But people are also commenting that this no longer works on Monterey
(a.k.a. macOS 12, the latest version).  It is not clear to me if this
refers to the code change, or to the "defaults write" command only:

    Just an update for others who stumble across this: this setting
    seems to have been removed in Monterey (12.0). It doesn't work for
    me any longer, and that seems consistent with some other new web
    searches turning up similar results.

Perhaps we should test doing something like the code above, and if that
works make it into a defcustom?  If that's not possible for some reason,
perhaps it should be documented in PROBLEMS?

I don't really do Objective-C or macOS development, so I can't help with
this, I'm afraid.  I'm happy to test a solution if someone were to write
up a patch though.