From ca231639b6b6b62945baa0f02059d6305a536ec7 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 13 Jul 2025 20:18:47 +0200 Subject: [PATCH] fix all-the-icons loading for terminal --- settings/gui-settings.el | 146 +++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 81 deletions(-) diff --git a/settings/gui-settings.el b/settings/gui-settings.el index d731a80b..046e861f 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -179,7 +179,7 @@ DISPLAY-START: `integer', e.g. 3820" :defer nil :after my-theme :hook (after-init . awesome-tray-mode) - :init (setq mode-line-format nil) + :init :config (setq awesome-tray-info-padding-right 1) (setq awesome-tray-buffer-name-buffer-changed t) @@ -189,10 +189,33 @@ DISPLAY-START: `integer', e.g. 3820" (setq awesome-tray-file-path-truncated-name-length 2) (setq awesome-tray-file-path-full-dirname-levels 2) + (defun my-awesome-tray-mode-hook-conf () + "Hide elements of the mode-line as long awesome-tray is active. +see `awesome-tray-mode-hook'" + (if awesome-tray-mode + (progn + (put 'mode-line-format + 'initial-value (default-toplevel-value 'mode-line-format)) + ;;(setq mode-line-format "") + (setq my-backup-mode-line-format mode-line-format) + (setq-default mode-line-format "") + (dolist (buf (buffer-list)) + (with-current-buffer buf + (setq mode-line-format ""))) + (message "now on")) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (setq mode-line-format my-backup-mode-line-format))) + (message "now off"))) + (add-hook 'awesome-tray-mode-hook #'my-awesome-tray-mode-hook-conf) + ;; flycheck custom string (defun my-awesome-tray-module-flycheck-info () - (let ((flycheck-mode-line-prefix "fc")) - (string-trim (flycheck-mode-line-status-text)))) + "see `awesome-tray-module-flycheck-info'" + (if (and (featurep 'flycheck) flycheck-mode) + (let ((flycheck-mode-line-prefix "fc")) + (string-trim (flycheck-mode-line-status-text))) + "")) ;; flycheck color string (defface my-awesome-tray-module-flycheck-face @@ -350,7 +373,7 @@ DISPLAY-START: `integer', e.g. 3820" (use-package all-the-icons :defer t - :if (display-graphic-p) + :init (require 'all-the-icons-autoloads) :config (when (and (not (my-font-installed-p "all-the-icons")) (window-system)) @@ -410,83 +433,44 @@ DISPLAY-START: `integer', e.g. 3820" (registers . "e") (custom . "b"))) - (if (display-graphic-p) - (let () - (require 'all-the-icons) - (setq dashboard-navigator-buttons - ;; list of lines having list of elements - ;; element: (icon title help action face prefix suffix) - ;; |------------------------- icon --------------------------------------|---- title ----|------ help ---------|------------- action ---------------------------------------|-face--|prefix|suffix| - `(;; 1st line custom views - (("" "" "space" nil default "" "") - ("" "Custom Views:" "custom views" nil default "" "") - (,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1) "ELisp" "my-view-elisp" (lambda (&rest _) (my-tab-view-elisp)) dashboard-navigator "" "") - (,(all-the-icons-alltheicon "python" :height 1.0 :v-adjust 0.0) "Python" "my-view-python" (lambda (&rest _) (my-tab-view-python)) dashboard-navigator "" "") - (,(all-the-icons-alltheicon "script" :height 1.0 :v-adjust 0.0) "Shell" "my-view-shell" (lambda (&rest _) (my-tab-view-shell)) dashboard-navigator "" "") - (,(all-the-icons-octicon "file-media" :height 1.0 :v-adjust 0.0) "Gnuplot" "my-view-gnuplot" (lambda (&rest _) (my-tab-view-gnuplot)) dashboard-navigator "" "") - (,(all-the-icons-octicon "file-pdf" :height 1.0 :v-adjust 0.0) "Org-PDF" "my-view-org-pdf" (lambda (&rest _) (my-tab-view-org-pdf)) dashboard-navigator "" "") - ) - ;; 2nd line major modes 1st part - (("" "" "space" nil default "" "") - ("" "Major Modes:" "major modes" nil default "" "") - ("" "Deft" "deft" (lambda (&rest _) (deft)) dashboard-navigator "" "") - ("" "EShell" "eshell-mode" (lambda (&rest _) (eshell)) dashboard-navigator "" "") - ("" "Magit" "magit" (lambda (&rest _) (magit)) dashboard-navigator "" "") - (,(all-the-icons-octicon "mail" :height 1.0 :v-adjust 0.0) "Mu4e" "mu4e" (lambda (&rest _) (mu4e)) dashboard-navigator "" "") - (,(all-the-icons-octicon "mail" :height 1.0 :v-adjust 0.0) "Notmuch" "notmuch" (lambda (&rest _) (notmuch)) dashboard-navigator "" "") - ("" "Org-Brain" "org-brain-visualize" (lambda (&rest _) (call-interactively 'org-brain-visualize)) dashboard-navigator "" "") - ) - ;; 3rd line major modes 2nd part - (("" "" "space" nil default "" "") - ("" "Org-Drill" "org-drill" (lambda (&rest _) (org-drill)) dashboard-navigator "" "") - ("" "Org-Roam" "org-raom-node-find" (lambda (&rest _) (org-roam-node-find nil "index")) dashboard-navigator "" "") - ("" "Powershell" "powershell" (lambda (&rest _) (powershell)) dashboard-navigator "" "") - ("" "Shell" "shell" (lambda (&rest _) (shell)) dashboard-navigator "" "") - ("" "Treemacs" "treemacs" (lambda (&rest _) (treemacs)) dashboard-navigator "" "") - ) - ;; 4th line infos - (("" "" "space" nil default "" "") - (,(all-the-icons-material "help_outline" :height 1.1 :v-adjust -0.15) "Help" "?/h" (lambda (&rest _) (describe-mode)) dashboard-navigator "" "") - (,(all-the-icons-material "help_outline" :height 1.1 :v-adjust -0.15) "My-Help" "my-help" (lambda (&rest _) (my-help)) dashboard-navigator "" "") - (,(all-the-icons-material "refresh" :height 1.1 :v-adjust -0.15) "Restart" "restart-emacs" (lambda (&rest _) (restart-emacs)) dashboard-navigator "" "") - )))) - (let () - (setq dashboard-navigator-buttons - ;; list of lines having list of elements - ;; element: (icon title help action face prefix suffix) - `(;; 1st line custom views - (("" "" "space" nil default "" "") - ("" "Custom Views:" "custom views" nil default "" "") - ("" "ELisp" "my-view-elisp" (lambda (&rest _) (my-tab-view-elisp)) dashboard-navigator "" "") - ("" "Python" "my-view-python" (lambda (&rest _) (my-tab-view-python)) dashboard-navigator "" "") - ("" "Shell" "my-view-shell" (lambda (&rest _) (my-tab-view-shell)) dashboard-navigator "" "") - ("" "Gnuplot" "my-view-gnuplot" (lambda (&rest _) (my-tab-view-gnuplot)) dashboard-navigator "" "") - ("" "Org-PDF" "my-view-org-pdf" (lambda (&rest _) (my-tab-view-org-pdf)) dashboard-navigator "" "") - ) - ;; 2nd line major modes 1st part - (("" "" "space" nil default "" "") - ("" "Major Modes:" "major modes" nil default "" "") - ("" "Deft" "deft" (lambda (&rest _) (deft)) dashboard-navigator "" "") - ("" "EShell" "eshell-mode" (lambda (&rest _) (eshell)) dashboard-navigator "" "") - ("" "Magit" "magit" (lambda (&rest _) (magit)) dashboard-navigator "" "") - ("" "Mu4e" "mu4e" (lambda (&rest _) (mu4e)) dashboard-navigator "" "") - ("" "Notmuch" "notmuch" (lambda (&rest _) (notmuch)) dashboard-navigator "" "") - ("" "Org-Brain" "org-brain-visualize" (lambda (&rest _) (call-interactively 'org-brain-visualize)) dashboard-navigator "" "") - ) - ;; 3rd line major modes 2nd part - (("" "" "space" nil default "" "") - ("" "Org-Drill" "org-drill" (lambda (&rest _) (org-drill)) dashboard-navigator "" "") - ("" "Org-Roam" "org-raom-node-find" (lambda (&rest _) (org-roam-node-find nil "index")) dashboard-navigator "" "") - ("" "Powershell" "powershell" (lambda (&rest _) (powershell)) dashboard-navigator "" "") - ("" "Shell" "shell" (lambda (&rest _) (shell)) dashboard-navigator "" "") - ("" "Treemacs" "treemacs" (lambda (&rest _) (treemacs)) dashboard-navigator "" "") - ) - ;; 4th line infos - (("" "" "space" nil default "" "") - ("" "Help" "?/h" (lambda (&rest _) (describe-mode)) dashboard-navigator "" "") - ("" "My-Help" "my-help" (lambda (&rest _) (my-help)) dashboard-navigator "" "") - ("" "Restart" "restart-emacs" (lambda (&rest _) (restart-emacs)) dashboard-navigator "" "") - ))))) + (require 'all-the-icons) + (setq dashboard-navigator-buttons + ;; list of lines having list of elements + ;; element: (icon title help action face prefix suffix) + ;; |------------------------- icon --------------------------------------|---- title ----|------ help ---------|------------- action ---------------------------------------|-face--|prefix|suffix| + `(;; 1st line custom views + (("" "" "space" nil default "" "") + ("" "Custom Views:" "custom views" nil default "" "") + (,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1) "ELisp" "my-view-elisp" (lambda (&rest _) (my-tab-view-elisp)) dashboard-navigator "" "") + (,(all-the-icons-alltheicon "python" :height 1.0 :v-adjust 0.0) "Python" "my-view-python" (lambda (&rest _) (my-tab-view-python)) dashboard-navigator "" "") + (,(all-the-icons-alltheicon "script" :height 1.0 :v-adjust 0.0) "Shell" "my-view-shell" (lambda (&rest _) (my-tab-view-shell)) dashboard-navigator "" "") + (,(all-the-icons-octicon "file-media" :height 1.0 :v-adjust 0.0) "Gnuplot" "my-view-gnuplot" (lambda (&rest _) (my-tab-view-gnuplot)) dashboard-navigator "" "") + (,(all-the-icons-octicon "file-pdf" :height 1.0 :v-adjust 0.0) "Org-PDF" "my-view-org-pdf" (lambda (&rest _) (my-tab-view-org-pdf)) dashboard-navigator "" "") + ) + ;; 2nd line major modes 1st part + (("" "" "space" nil default "" "") + ("" "Major Modes:" "major modes" nil default "" "") + ("" "Deft" "deft" (lambda (&rest _) (deft)) dashboard-navigator "" "") + ("" "EShell" "eshell-mode" (lambda (&rest _) (eshell)) dashboard-navigator "" "") + ("" "Magit" "magit" (lambda (&rest _) (magit)) dashboard-navigator "" "") + (,(all-the-icons-octicon "mail" :height 1.0 :v-adjust 0.0) "Mu4e" "mu4e" (lambda (&rest _) (mu4e)) dashboard-navigator "" "") + (,(all-the-icons-octicon "mail" :height 1.0 :v-adjust 0.0) "Notmuch" "notmuch" (lambda (&rest _) (notmuch)) dashboard-navigator "" "") + ("" "Org-Brain" "org-brain-visualize" (lambda (&rest _) (call-interactively 'org-brain-visualize)) dashboard-navigator "" "") + ) + ;; 3rd line major modes 2nd part + (("" "" "space" nil default "" "") + ("" "Org-Drill" "org-drill" (lambda (&rest _) (org-drill)) dashboard-navigator "" "") + ("" "Org-Roam" "org-raom-node-find" (lambda (&rest _) (org-roam-node-find nil "index")) dashboard-navigator "" "") + ("" "Powershell" "powershell" (lambda (&rest _) (powershell)) dashboard-navigator "" "") + ("" "Shell" "shell" (lambda (&rest _) (shell)) dashboard-navigator "" "") + ("" "Treemacs" "treemacs" (lambda (&rest _) (treemacs)) dashboard-navigator "" "") + ) + ;; 4th line infos + (("" "" "space" nil default "" "") + (,(all-the-icons-material "help_outline" :height 1.1 :v-adjust -0.15) "Help" "?/h" (lambda (&rest _) (describe-mode)) dashboard-navigator "" "") + (,(all-the-icons-material "help_outline" :height 1.1 :v-adjust -0.15) "My-Help" "my-help" (lambda (&rest _) (my-help)) dashboard-navigator "" "") + (,(all-the-icons-material "refresh" :height 1.1 :v-adjust -0.15) "Restart" "restart-emacs" (lambda (&rest _) (restart-emacs)) dashboard-navigator "" "") + ))) ;; because we use `use-package' include `use-package-statistics' if ;; computed