diff --git a/lisp/doom-start.el b/lisp/doom-start.el index 443d07f87..60a5b1014 100644 --- a/lisp/doom-start.el +++ b/lisp/doom-start.el @@ -93,7 +93,34 @@ (add-hook 'doom-first-buffer-hook #'gcmh-mode) -;;; Language +;;; Disable UI elements early +;; PERF,UI: Doom strives to be keyboard-centric, so I consider these UI elements +;; clutter. Initializing them also costs a morsel of startup time. Whats more, +;; the menu bar exposes functionality that Doom doesn't endorse. Perhaps one +;; day Doom will support these, but today is not that day. +;; +;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and +;; `scroll-bar-mode' because they do extra work to manipulate frame variables +;; that isn't necessary this early in the startup process. +(setq scroll-bar-mode nil + tool-bar-mode nil + menu-bar-mode nil) +;; Setting `scroll-bar-mode' isn't enough to disable them, so: +(push '(vertical-scroll-bars) default-frame-alist) +;; FIX: On MacOS, disabling the menu bar makes MacOS treat Emacs as a +;; non-application window -- which means it doesn't automatically capture +;; focus when it is started, among other things, so enable the menu-bar for +;; GUI frames, but keep it disabled in terminal frames because there it +;; activates an ugly, in-frame menu bar. +(when IS-MAC + (add-hook! '(window-setup-hook after-make-frame-functions) + (defun doom-restore-menu-bar-in-gui-frames-h (&optional frame) + (when-let (frame (or frame (selected-frame))) + (when (display-graphic-p frame) + (set-frame-parameter frame 'menu-bar-lines 1)))))) + + +;;; Encodings ;; Contrary to what many Emacs users have in their configs, you don't need more ;; than this to make UTF-8 the default coding system: (set-language-environment "UTF-8") diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index 4c42b3eb6..c4a6ca1b1 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -255,22 +255,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; when resizing too many windows at once or rapidly. (setq window-resize-pixelwise nil) -;; UI: Doom strives to be keyboard-centric, so I consider these UI elements -;; clutter. Initializing them also costs a morsel of startup time. Whats more, -;; the menu bar exposes functionality that Doom doesn't endorse. Perhaps one -;; day Doom will support these, but today is not that day. -;; -;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and -;; `scroll-bar-mode' because they do extra work to manipulate frame variables -;; that isn't necessary this early in the startup process. -(setq scroll-bar-mode nil - tool-bar-mode nil - ;; Disabling `menu-bar-mode' causes focus issues on MacOS. The :os macos - ;; module has a fix for this. - menu-bar-mode nil) -;; Setting `scroll-bar-mode' isn't enough to disable them, so: -(push '(vertical-scroll-bars) default-frame-alist) - ;; UX: GUIs are inconsistent across systems, desktop environments, and themes, ;; and don't match the look of Emacs. They also impose inconsistent shortcut ;; key paradigms. I'd rather Emacs be responsible for prompting. diff --git a/modules/os/macos/config.el b/modules/os/macos/config.el index c1d09aaed..ad91aa0f7 100644 --- a/modules/os/macos/config.el +++ b/modules/os/macos/config.el @@ -29,18 +29,6 @@ (require 'ns-auto-titlebar nil t) (ns-auto-titlebar-mode +1)) -;; HACK: On MacOS, disabling the menu bar makes MacOS treat Emacs as a -;; non-application window -- which means it doesn't automatically capture -;; focus when it is started, among other things, so enable the menu-bar for -;; GUI frames, but keep it disabled in terminal frames because there it -;; activates an ugly, in-frame menu bar. -(add-hook! '(window-setup-hook after-make-frame-functions) - (defun doom-init-menu-bar-in-gui-frames-h (&optional frame) - "Re-enable menu-bar-lines in GUI frames." - (when-let (frame (or frame (selected-frame))) - (when (display-graphic-p frame) - (set-frame-parameter frame 'menu-bar-lines 1))))) - ;; Integrate with Keychain (after! auth-source (pushnew! auth-sources 'macos-keychain-internet 'macos-keychain-generic))