Closed Shooooooooo closed 4 years ago
I was planning, but the icons-in-terminal
itself seems stopping developing and maintaining. And it's not convenient to install on all platforms. If you want to use icons-in-terminal.el
in doom-modeline
, you can use this trick.
(with-eval-after-load 'all-the-icons
(require 'icons-in-terminal)
(setq doom-modeline-icon t)
(set-fontset-font t 'unicode "icons-in-terminal" nil 'prepend)
(defalias #'all-the-icons-insert #'icons-in-terminal-insert)
(defalias #'all-the-icons-insert-faicon #'icons-in-terminal-insert-faicon)
(defalias #'all-the-icons-insert-fileicon #'icons-in-terminal-insert-fileicon)
(defalias #'all-the-icons-insert-material #'icons-in-terminal-insert-material)
(defalias #'all-the-icons-insert-octicon #'icons-in-terminal-insert-octicon)
(defalias #'all-the-icons-insert-wicon #'icons-in-terminal-insert-wicon)
(defalias #'all-the-icons-icon-for-dir #'icons-in-terminal-icon-for-dir)
(defalias #'all-the-icons-icon-for-file #'icons-in-terminal-icon-for-file)
(defalias #'all-the-icons-icon-for-mode #'icons-in-terminal-icon-for-mode)
(defalias #'all-the-icons-icon-for-url #'icons-in-terminal-icon-for-url)
(defalias #'all-the-icons-icon-family #'icons-in-terminal-icon-family)
(defalias #'all-the-icons-icon-family-for-buffer #'icons-in-terminal-icon-family-for-buffer)
(defalias #'all-the-icons-icon-family-for-file #'icons-in-terminal-icon-family-for-file)
(defalias #'all-the-icons-icon-family-for-mode #'icons-in-terminal-icon-family-for-mode)
(defalias #'all-the-icons-icon-for-buffer #'icons-in-terminal-icon-for-buffer)
(defalias #'all-the-icons-faicon #'icons-in-terminal-faicon)
(defalias #'all-the-icons-octicon #'icons-in-terminal-octicon)
(defalias #'all-the-icons-fileicon #'icons-in-terminal-fileicon)
(defalias #'all-the-icons-material #'icons-in-terminal-material)
(defalias #'all-the-icons-wicon #'icons-in-terminal-wicon)
;; (defalias 'icons-in-terminal-dir-icon-alist 'icons-in-terminal-dir-icon-spec)
;; (defalias 'icons-in-terminal-weather-icon-alist 'icons-in-terminal-weather-icon-spec)
(defalias 'all-the-icons-default-adjust 'icons-in-terminal-default-adjust)
(defalias 'all-the-icons-color-icons 'icons-in-terminal-color-icons)
(defalias 'all-the-icons-scale-factor 'icons-in-terminal-scale-factor)
(defalias 'all-the-icons-icon-alist 'icons-in-terminal-icon-alist)
(defalias 'all-the-icons-dir-icon-alist 'icons-in-terminal-dir-icon-alist)
(defalias 'all-the-icons-weather-icon-alist 'icons-in-terminal-weather-icon-alist)
)
Some icons may not be displayed perfectly since they are not adapted, but the most of them look good.
Thanks for the info and the trick!
However, this seems to break helm and some other functionality like meta-shift-: ?
doom-modeline-update-buffer-file-icon: Wrong type argument: stringp, nil
You need to dig out the root cause with the backtrace, and then make the changes to adapt the new version, I think. I didn't test with the latest version of doom-modeline
and all-the-icons
.
The issue only comes up when I do setq doom-modeline-major-mode-icon t
, and when it comes up, I can't even switch to backtrace buffer ;) because it then errors again..
Anyway, maybe I should stop spending time on figuring this out due to the stall of maintenance upstream. Thanks a lot~
Closing this issue.
Well, I took a quick look at the function doom-modeline-update-buffer-file-icon
. The root cause may be the icon doesn't exist for some buffers. Try evaluate the snippet below:
(defun doom-modeline-update-buffer-file-icon (&rest _)
"Update file icon in mode-line."
(setq doom-modeline--buffer-file-icon
(when (and doom-modeline-icon doom-modeline-major-mode-icon)
(when-let ((icon (all-the-icons-icon-for-buffer)))
(propertize (if (symbolp icon)
(doom-modeline-icon 'faicon "file-o" nil nil
:face 'all-the-icons-dsilver
:v-adjust 0.0)
icon)
'help-echo (format "Major-mode: %s" (format-mode-line mode-name))
'display '(raise -0.135))))))
That worked! Thanks~ Do you plan to commit this to doom-modeline?
Yep, I will commit but I'd like get a better solution.
Updated: already committed.
Cool! Thanks~
Is there any future plane for this project? It would be nice to have icons supported in doom-emacs under TTY.