refactor!: replace all-the-icons with nerd-icons

BREAKING CHANGE: This commit replaces all-the-icons with nerd-fonts. Any
all-the-icons-* function calls or variable references in your private
config will break and should be replaced with their nerd-icons-*
equivalent. That said, Doom will continue to install all-the-icons for
a while, so feel free to load it if you don't want to fully commit to
the change yet.

This change is happening because nerd-icon has wider support for GUI and
TUI Emacs; has a larger, more consistent selection of symbols; plus unicode
coverage.

Fix: #7368
Close: #6675
Close: #7364
This commit is contained in:
Ellis Kenyő 2023-09-14 00:03:55 +01:00 committed by GitHub
parent 7bdf7cf7c0
commit 9787022b83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 293 additions and 407 deletions

View file

@ -41,9 +41,9 @@ Besides eye candy, the dashboard serves two other purposes:
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
This module only requires that ~all-the-icons~'s icon fonts are installed, which
This module only requires that ~nerd-icons~'s icon fonts are installed, which
should've been installed when you ran ~$ doom install~. Otherwise, use ~M-x
all-the-icons-install-fonts~ to install them.
nerd-icons-install-fonts~ to install them.
* Usage
Once this module is enabled, the dashboard will present itself after opening a
@ -88,7 +88,7 @@ color from the theme) you can make use of ~custom-set-faces!~ or
(custom-set-faces!
'(doom-dashboard-banner :foreground "red" :background "#000000" :weight bold)
'(doom-dashboard-footer :inherit font-lock-constant-face)
'(doom-dashboard-footer-icon :inherit all-the-icons-red)
'(doom-dashboard-footer-icon :inherit nerd-icons-red)
'(doom-dashboard-loaded :inherit font-lock-warning-face)
'(doom-dashboard-menu-desc :inherit font-lock-string-face)
'(doom-dashboard-menu-title :inherit font-lock-function-name-face))
@ -99,7 +99,7 @@ or for a per-theme setting
(custom-theme-set-faces! 'doom-tomorrow-night
'(doom-dashboard-banner :foreground "red" :background "#000000" :weight bold)
'(doom-dashboard-footer :inherit font-lock-constant-face)
'(doom-dashboard-footer-icon :inherit all-the-icons-red)
'(doom-dashboard-footer-icon :inherit nerd-icons-red)
'(doom-dashboard-loaded :inherit font-lock-warning-face)
'(doom-dashboard-menu-desc :inherit font-lock-string-face)
'(doom-dashboard-menu-title :inherit font-lock-function-name-face))

View file

@ -47,32 +47,31 @@ Possible values:
(defvar +doom-dashboard-menu-sections
'(("Recently opened files"
:icon (all-the-icons-octicon "file-text" :face 'doom-dashboard-menu-title)
:face (:inherit (doom-dashboard-menu-title bold))
:icon (nerd-icons-faicon "nf-fa-file_text" :face 'doom-dashboard-menu-title)
:action recentf-open-files)
("Reload last session"
:icon (all-the-icons-octicon "history" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-history" :face 'doom-dashboard-menu-title)
:when (cond ((modulep! :ui workspaces)
(file-exists-p (expand-file-name persp-auto-save-fname persp-save-dir)))
((require 'desktop nil t)
(file-exists-p (desktop-full-file-name))))
:action doom/quickload-session)
("Open org-agenda"
:icon (all-the-icons-octicon "calendar" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-calendar" :face 'doom-dashboard-menu-title)
:when (fboundp 'org-agenda)
:action org-agenda)
("Open project"
:icon (all-the-icons-octicon "briefcase" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-briefcase" :face 'doom-dashboard-menu-title)
:action projectile-switch-project)
("Jump to bookmark"
:icon (all-the-icons-octicon "bookmark" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-bookmark" :face 'doom-dashboard-menu-title)
:action bookmark-jump)
("Open private configuration"
:icon (all-the-icons-octicon "tools" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-tools" :face 'doom-dashboard-menu-title)
:when (file-directory-p doom-user-dir)
:action doom/open-private-config)
("Open documentation"
:icon (all-the-icons-octicon "book" :face 'doom-dashboard-menu-title)
:icon (nerd-icons-octicon "nf-oct-book" :face 'doom-dashboard-menu-title)
:action doom/help))
"An alist of menu buttons used by `doom-dashboard-widget-shortmenu'. Each
element is a cons cell (LABEL . PLIST). LABEL is a string to display after the
@ -98,9 +97,6 @@ PLIST can have the following properties:
(defvar +doom-dashboard--pwd-alist ())
(defvar +doom-dashboard--reload-timer nil)
(defvar all-the-icons-scale-factor)
(defvar all-the-icons-default-adjust)
;;
;;; Bootstrap
@ -151,7 +147,7 @@ PLIST can have the following properties:
"Face used for the footer on the dashboard"
:group 'doom-dashboard)
(defface doom-dashboard-footer-icon '((t (:inherit all-the-icons-green)))
(defface doom-dashboard-footer-icon '((t (:inherit nerd-icons-green)))
"Face used for the icon of the footer on the dashboard"
:group 'doom-dashboard)
@ -456,60 +452,58 @@ What it is set to is controlled by `+doom-dashboard-pwd-policy'."
"\n")))
(defun doom-dashboard-widget-shortmenu ()
(let ((all-the-icons-scale-factor 1.45)
(all-the-icons-default-adjust -0.02))
(insert "\n")
(dolist (section +doom-dashboard-menu-sections)
(cl-destructuring-bind (label &key icon action when face key) section
(when (and (fboundp action)
(or (null when)
(eval when t)))
(insert
(+doom-dashboard--center
(- +doom-dashboard--width 1)
(let ((icon (if (stringp icon) icon (eval icon t))))
(format (format "%s%%s%%-10s" (if icon "%3s\t" "%3s"))
(or icon "")
(with-temp-buffer
(insert-text-button
label
'action
`(lambda (_)
(call-interactively (or (command-remapping #',action)
#',action)))
'face (or face 'doom-dashboard-menu-title)
'follow-link t
'help-echo
(format "%s (%s)" label
(propertize (symbol-name action) 'face 'doom-dashboard-menu-desc)))
(format "%-37s" (buffer-string)))
;; Lookup command keys dynamically
(propertize
(or key
(when-let*
((keymaps
(delq
nil (list (when (bound-and-true-p evil-local-mode)
(evil-get-auxiliary-keymap +doom-dashboard-mode-map 'normal))
+doom-dashboard-mode-map)))
(key
(or (when keymaps
(where-is-internal action keymaps t))
(where-is-internal action nil t))))
(with-temp-buffer
(save-excursion (insert (key-description key)))
(while (re-search-forward "<\\([^>]+\\)>" nil t)
(let ((str (match-string 1)))
(replace-match
(upcase (if (< (length str) 3)
str
(substring str 0 3))))))
(buffer-string)))
"")
'face 'doom-dashboard-menu-desc))))
(if (display-graphic-p)
"\n\n"
"\n")))))))
(insert "\n")
(dolist (section +doom-dashboard-menu-sections)
(cl-destructuring-bind (label &key icon action when face key) section
(when (and (fboundp action)
(or (null when)
(eval when t)))
(insert
(+doom-dashboard--center
(- +doom-dashboard--width 1)
(let ((icon (if (stringp icon) icon (eval icon t))))
(format (format "%s%%s%%-10s" (if icon "%3s\t" "%3s"))
(or icon "")
(with-temp-buffer
(insert-text-button
label
'action
`(lambda (_)
(call-interactively (or (command-remapping #',action)
#',action)))
'face (or face 'doom-dashboard-menu-title)
'follow-link t
'help-echo
(format "%s (%s)" label
(propertize (symbol-name action) 'face 'doom-dashboard-menu-desc)))
(format "%-37s" (buffer-string)))
;; Lookup command keys dynamically
(propertize
(or key
(when-let*
((keymaps
(delq
nil (list (when (bound-and-true-p evil-local-mode)
(evil-get-auxiliary-keymap +doom-dashboard-mode-map 'normal))
+doom-dashboard-mode-map)))
(key
(or (when keymaps
(where-is-internal action keymaps t))
(where-is-internal action nil t))))
(with-temp-buffer
(save-excursion (insert (key-description key)))
(while (re-search-forward "<\\([^>]+\\)>" nil t)
(let ((str (match-string 1)))
(replace-match
(upcase (if (< (length str) 3)
str
(substring str 0 3))))))
(buffer-string)))
"")
'face 'doom-dashboard-menu-desc))))
(if (display-graphic-p)
"\n\n"
"\n"))))))
(defun doom-dashboard-widget-footer ()
(insert
@ -517,7 +511,7 @@ What it is set to is controlled by `+doom-dashboard-pwd-policy'."
(+doom-dashboard--center
(- +doom-dashboard--width 2)
(with-temp-buffer
(insert-text-button (or (all-the-icons-octicon "octoface" :face 'doom-dashboard-footer-icon :height 1.3 :v-adjust -0.15)
(insert-text-button (or (nerd-icons-codicon "nf-cod-octoface" :face 'doom-dashboard-footer-icon :height 1.3 :v-adjust -0.15)
(propertize "github" 'face 'doom-dashboard-footer))
'action (lambda (_) (browse-url "https://github.com/hlissner/doom-emacs"))
'follow-link t