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.