fix: disable UI elements earlier
Moves this from doom-ui to doom-start, since there is more savings to be had if this is done early. Also moves the menu-bar fix for macos out of the :os macos module into doom-start, because it is a fix (and for a Doom optimization) and not a feature, so it shouldn't be behind a module.
This commit is contained in:
parent
1be11539e8
commit
41051f4761
3 changed files with 28 additions and 29 deletions
|
@ -93,7 +93,34 @@
|
||||||
(add-hook 'doom-first-buffer-hook #'gcmh-mode)
|
(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
|
;; 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:
|
;; than this to make UTF-8 the default coding system:
|
||||||
(set-language-environment "UTF-8")
|
(set-language-environment "UTF-8")
|
||||||
|
|
|
@ -255,22 +255,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
;; when resizing too many windows at once or rapidly.
|
;; when resizing too many windows at once or rapidly.
|
||||||
(setq window-resize-pixelwise nil)
|
(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,
|
;; UX: GUIs are inconsistent across systems, desktop environments, and themes,
|
||||||
;; and don't match the look of Emacs. They also impose inconsistent shortcut
|
;; and don't match the look of Emacs. They also impose inconsistent shortcut
|
||||||
;; key paradigms. I'd rather Emacs be responsible for prompting.
|
;; key paradigms. I'd rather Emacs be responsible for prompting.
|
||||||
|
|
|
@ -29,18 +29,6 @@
|
||||||
(require 'ns-auto-titlebar nil t)
|
(require 'ns-auto-titlebar nil t)
|
||||||
(ns-auto-titlebar-mode +1))
|
(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
|
;; Integrate with Keychain
|
||||||
(after! auth-source
|
(after! auth-source
|
||||||
(pushnew! auth-sources 'macos-keychain-internet 'macos-keychain-generic))
|
(pushnew! auth-sources 'macos-keychain-internet 'macos-keychain-generic))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue