How to have (tool-bar-mode 0) apply at startup to avoid large title bar on macOS Sonoma when using railwaycat/homebrew-emacsmacport

What happened?

For more context, see this GitHub issue. When installing emacs-mac via Homebrew with --with-natural-title-bar on macOS Sonoma, there is a very large title bar. I think this is because of the size of the tool bar icons, as you can see in the linked GitHub issue.

If you start Emacs like /Applications/ -q --eval '(tool-bar-mode 0)', then the title bar ends up being a reasonable size.

However, with Doom Emacs, simply putting (tool-bar-mode 0) in config.el doesn’t fix the issue because it seems like Doom is lazy loading tool bar configuration, as far as I can tell. But if I explicitly toggle tool-bar-mode off after Doom has started up, then the title bar shrinks to a more reasonable size.

What did you expect to happen?

I expected setting (tool-bar-mode 0) in config.el to shrink the title bar to a more reasonable size at Emacs startup time. How can I have the title bar be a reasonable size at Emacs startup time without having to explicitly toggle tool-bar-mode off after Emacs has started?

Steps to reproduce

  1. brew install emacs-mac --with-natural-title-bar
  2. /Applications/ -q to get large title bar
  3. /Applications/ -q --eval '(tool-bar-mode 0)' to get small/reasonable title bar
  4. /Applications/ to get large title bar with Doom configuration (regardless of whether config.el contains (tool-bar-mode 0))

System information

Loading data dump...

What about wrapping the line in an after!?

(after! tool-bar-mode
    (tool-bar-mode 0))

Appreciate the suggestion, but that doesn’t work, unfortunately.

I have a function which solves this bug temporarily:

(add-hook 'doom-after-init-hook (lambda () (tool-bar-mode 1) (tool-bar-mode 0)))

1 Like

Thanks! That suggestion works for me. Any idea what the ultimate source of the issue is here and what a more permanent fix might look like? Perhaps I should be opening an issue against Doom Emacs instead of asking this question here if this is a bug?

Based on the fact, that opening emacs with emacs -Q --eval='(tool-bar-mode 0)' opens it with a normal sized toolbar, I believe, that it is indeed a bug in doom emacs.

1 Like

Thanks, I opened a bug report here.

Based on the bug reported in the above comment, this seems to be fixed. I upgraded my mac to sonoma today (12/27/2023) and I am facing this issue. Based on information in the git link - I can see that that fix is applied. In my mac, I can see that my emacs-mac (installed based on instructions from railwaycat/emacsmacport), but the latest version I have does not seem to have that fix applied.

Can anyone help me by confirming if this issue has to be fixed in the interim by using a different branch’s code for emacs-mac? For now, I am manually disabling tool-bar-mode everytime after start-up

The issue was apparently fixed in mituharu/emacs-mac@5f6c306. So far, this has not been merged into the master branch as part of a stable release; it’s only the work branch. I think you should be able to get the fix, though, by installing via Homebrew with @railwaycat’s version using the --HEAD option, which installs from the work branch of the upstream repo.

I haven’t yet tried this myself. I’ve just been using the workaround discussed in this thread until it’s made into part of a stable release.

1 Like

Thanks, I will also use the workaround for now - will wait for the fix to go to stable branch! :+1:

Thanks! Using brew install emacs-mac --HEAD works pretty well. After the installation, the huge title bar is gone. I’m new to emacs-mac build, the Emasc native support for blur also works for now: (add-to-list 'default-frame-alist '(alpha-background . 50)), it surprised me.