 (defvar +doom-dashboard-name "*doom*"
   "The name to use for the dashboard buffer.")
 
-(defvar +doom-dashboard-functions '(doom-dashboard-widget-banner
-                                    doom-dashboard-widget-shortmenu
-                                    doom-dashboard-widget-loaded)
+(defvar +doom-dashboard-functions
+  '(doom-dashboard-widget-banner
+    doom-dashboard-widget-shortmenu
+    doom-dashboard-widget-loaded
+    doom-dashboard-widget-footer)
   "List of widget functions to run in the dashboard buffer to construct the
 dashboard. These functions take no arguments and the dashboard buffer is current
 while they run.")

  (setq-local whitespace-style nil)
  (setq-local show-trailing-whitespace nil)
  (setq-local hscroll-margin 0)
  (cl-loop for (car . _cdr) in fringe-indicator-alist
           collect (cons car nil) into alist
           finally do (setq fringe-indicator-alist alist))

     +doom-dashboard--width
     (doom|display-benchmark 'return))
    'face 'font-lock-comment-face)
   "\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 key face) section
        (when (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
                         (propertize label 'face (or face 'font-lock-keyword-face))
                         'action `(lambda (_) ,action)
                         'follow-link t
                         'help-echo label)
                        (format "%-37s" (buffer-string)))
                      ;; Lookup command keys dynamically
                      (cond ((null key) "")
                            ((stringp key)
                             (propertize key 'face 'font-lock-constant-face))
                            ((listp key)
                             (eval key t))))))
           (if (display-graphic-p)
               "\n\n"
             "\n")))))))

(defun doom-dashboard-widget-footer ()
  (insert
   "\n"
   (+doom-dashboard--center
    (- +doom-dashboard--width 2)
    (with-temp-buffer
      ;; TODO Publish the site!
      ;; (insert-text-button (propertize "doomemacs.org" 'face 'font-lock-keyword-face)
      ;;                     'action (lambda (_) (browse-url "http://github.com/hlissner/doom-emacs"))
      ;;                     'follow-link t
      ;;                     'help-echo "Open home page")
      ;; (insert (propertize " x " 'face 'font-lock-comment-face))
      (insert-text-button (or (all-the-icons-octicon "octoface" :face 'all-the-icons-green :height 1.3 :v-adjust -0.15)
                              (propertize "github" 'face 'font-lock-keyword-face))
                          'action (lambda (_) (browse-url "https://github.com/hlissner/doom-emacs"))
                          'follow-link t
                          'help-echo "Open github page")
      (buffer-string)))
   "\n"))
