Made the dashboard prettier

I wanted to visually see what features I have available.
This commit is contained in:
Howard Abrams 2023-08-28 17:21:23 -07:00
parent 4cc7b42cf5
commit da51188cc1
2 changed files with 66 additions and 24 deletions

View file

@ -681,6 +681,14 @@ And ways to stop the system:
"q q" '("quit emacs" . save-buffers-kill-terminal) "q q" '("quit emacs" . save-buffers-kill-terminal)
"q Q" '("quit without saving" . evil-quit-all-with-error-code)) "q Q" '("quit without saving" . evil-quit-all-with-error-code))
#+end_src #+end_src
And ways to load my tangled org-files:
#+begin_src emacs-lisp
(ha-leader
"h h" '(:ignore t :which-key "hamacs")
"h h f" '("features" . ha-hamacs-features)
"h h h" '("reload" . ha-hamacs-load)
"h h a" '("reload all" . ha-hamacs-reload-all))
#+end_src
*** File Operations *** File Operations
While =find-file= is still my bread and butter, I like getting information about the file associated with the buffer. For instance, the file path: While =find-file= is still my bread and butter, I like getting information about the file associated with the buffer. For instance, the file path:
#+begin_src emacs-lisp #+begin_src emacs-lisp

View file

@ -66,27 +66,59 @@ For this, I use the [[https://github.com/tkf/emacs-request][request]] package (a
** Features ** Features
I would appreciate seeing if my Emacs installation has the features that I expect: I would appreciate seeing if my Emacs installation has the features that I expect:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun ha-hamacs-features (&optional iconic) (defun ha-hamacs-features (&optional non-iconic)
"Simple display of features I'm most keen about. "Simple display of features I'm most keen about.
If ICONIC is non-nil, return a string of icons." If NON-ICONIC is non-nil, return a string of text only."
(interactive) (interactive)
(let* ((png-icon (all-the-icons-material "image"))
(svg-icon (all-the-icons-alltheicon "svg")) (defun feature-combo (icon title)
(ts-icon (all-the-icons-faicon "tree")) (if (or non-iconic (null icon))
(tls-icon (all-the-icons-faicon "expeditedssl")) title
(json-icon (all-the-icons-fileicon "jsx")) (format "%s—%s" icon title)))
(mag-icon (all-the-icons-faicon "magic"))
(jit-icon (all-the-icons-faicon "cog")) (defun all-images ()
(results (s-join " " (s-join "·"
(list (when (and (fboundp 'native-comp-available-p) (-remove 'null
(native-comp-available-p)) (list
(if iconic jit-icon "Native-Compilation")) (when (image-type-available-p 'gif) "GIF")
(when (treesit-available-p) (if iconic ts-icon "TreeSit")) (when (image-type-available-p 'svg) "SVG")
(when (image-type-available-p 'svg) (if iconic svg-icon "SVG")) (when (image-type-available-p 'jpeg) "JPG")
(when (image-type-available-p 'png) (if iconic png-icon "PNG")) (when (image-type-available-p 'tiff) "TIFF")
(when (gnutls-available-p) (if iconic tls-icon "TLS")) (when (image-type-available-p 'webp) "WEBP")
(when (json-available-p) (if iconic json-icon "JSON")) (when (image-type-available-p 'png) "PNG")))))
(when (fboundp 'imagemagick-types) (if iconic mag-icon "ImageMagick"))))))
(let* ((features
(list (when (and (fboundp 'native-comp-available-p)
(native-comp-available-p))
(feature-combo (all-the-icons-faicon "cog") "Native Compilation"))
(when (eq (window-system) 'ns)
(feature-combo (all-the-icons-faicon "apple") "MacOS"))
(when (eq (window-system) 'pgtk)
(feature-combo (all-the-icons-faicon "xing") "Gnome"))
(when (treesit-available-p)
(feature-combo (all-the-icons-faicon "tree") "Tree Sitter"))
(when (sqlite-available-p)
(feature-combo (all-the-icons-faicon "database") "Sqlite"))
(when (gnutls-available-p)
(feature-combo (all-the-icons-faicon "expeditedssl") "TLS"))
;; TODO:
;; Mailutils? How do we figure out if we are using Gnu Mailutils?
;; (mail-icon (all-the-icons-material "mail"))
;; XWidgets? Need to get on my Linux box and compile this.
;; (widget-icon (all-the-icons-material "widgets"))
(when (fboundp 'module-load)
(feature-combo (all-the-icons-faicon "th") "Modules"))
(when (json-available-p)
(feature-combo (all-the-icons-fileicon "config-js") "JSON"))
(when (string-search "HARFBUZZ" system-configuration-features)
(feature-combo (all-the-icons-faicon "font") "HARFBUZZ"))
(when (string-search "DBUS" system-configuration-features)
(feature-combo (all-the-icons-faicon "bus") "DBUS"))
(feature-combo (all-the-icons-faicon "picture-o") (all-images))
(when (fboundp 'imagemagick-types)
(feature-combo (all-the-icons-faicon "magic") "ImageMagick"))))
(results (s-join " " (-remove 'null features))))
(if (called-interactively-p) (if (called-interactively-p)
(message "Enabled features: %s" results) (message "Enabled features: %s" results)
results))) results)))
@ -217,13 +249,15 @@ The =dashboard= project hooks to [[help:emacs-startup-hook][emacs-startup-hook]]
(split-window-horizontally) (split-window-horizontally)
(other-window 1) (other-window 1)
(switch-to-buffer "*cheatsheet*") (switch-to-buffer "*cheatsheet*")
(cheatsheet-mode) (ignore-errors
(erase-buffer) (cheatsheet-mode)
(insert (cheatsheet--format)) (erase-buffer)
(setq buffer-read-only t) (insert (cheatsheet--format))
(setq buffer-read-only t))
;; (shrink-window-horizontally (- (window-size nil t) 50)) ;; (shrink-window-horizontally (- (window-size nil t) 50))
(shrink-window-horizontally 40) (shrink-window-horizontally 40)
(goto-char (point-min))) (goto-char (point-min))
(call-interactively 'ha-hamacs-features))
#+end_src #+end_src
* Technical Artifacts :noexport: * Technical Artifacts :noexport: