            (warn "`+doom-dashboard-pwd-policy' has an invalid value of '%s'"
                  policy)))))
 
-;; widgets
+
+;;
+;; Widgets
+;;
+
 (defun doom-dashboard-widget--banner ()
   (mapc (lambda (line)
           (insert (propertize (+doom-dashboard--center +doom-dashboard--width line)

    (dolist (win (get-buffer-window-list fallback-buffer nil t))
      (set-window-fringes win 0 0)
      (set-window-margins
       win (max 0 (/ (- (window-total-width win) +doom-dashboard--width) 2)))))
  t)

;; helpers
(defun +doom-dashboard--center (len s)

(defvar all-the-icons-default-adjust)

;;
(setq doom-fallback-buffer +doom-dashboard-name
      initial-buffer-choice #'+doom-dashboard)


;;
;; Commands
;;

(defun +doom-dashboard/open (frame &optional noswitch)
  (interactive (list (selected-frame)))
  (unless (run-hook-with-args-until-success '+doom-dashboard-inhibit-functions)
    (prog1
        (unless +doom-dashboard-inhibit-refresh
          (with-selected-frame frame
            (unless noswitch
              (switch-to-buffer (doom-fallback-buffer)))
            (+doom-dashboard-reload)))
      (setq +doom-dashboard-inhibit-refresh nil)
      (current-buffer))))


;;
;; Library
;;

(define-derived-mode +doom-dashboard-mode special-mode
  (format "DOOM v%s" doom-version)
  "Major mode for the DOOM dashboard buffer."
  (setq truncate-lines t)
  (setq-local whitespace-style nil)
  (setq-local show-trailing-whitespace nil)
  (cl-loop for (car . _cdr) in fringe-indicator-alist
           collect (cons car nil) into alist
           finally do (setq fringe-indicator-alist alist)))
(add-hook '+doom-dashboard-mode-hook #'read-only-mode)

(defun +doom-dashboard ()
  "Initialize doom-dashboard and set up its hooks. Meant to be used with
`initial-buffer-choice'. Returns the resulting buffer."
  (map! :map +doom-dashboard-mode-map
        "n" #'+doom-dashboard/next-button
        "p" #'+doom-dashboard/previous-button
        "N" #'+doom-dashboard/last-button
        "P" #'+doom-dashboard/first-button
        :em "j" #'+doom-dashboard/next-button
        :em "k" #'+doom-dashboard/previous-button
        :em "gg" #'+doom-dashboard/first-button
        :em "G"  #'+doom-dashboard/last-button
        [remap evil-insert]      #'evil-normal-state
        [remap evil-change]      #'evil-normal-state
        [remap evil-visual-char] #'evil-normal-state
        [remap evil-visual-line] #'evil-normal-state
        [remap evil-delete]      #'evil-normal-state
        [remap evil-delete-char] #'evil-normal-state)

  (add-hook 'window-configuration-change-hook #'+doom-dashboard-reload)
  (add-hook 'focus-in-hook #'+doom-dashboard-reload)
  (add-hook 'kill-buffer-query-functions #'+doom-dashboard|reload-on-kill)
  (when (daemonp)
    (add-hook 'after-make-frame-functions #'+doom-dashboard|make-frame))
  (if (doom-real-buffer-p)
      (current-buffer)
    (let ((default-directory doom-emacs-dir))
      (+doom-dashboard/open (selected-frame) t))))

(defun +doom-dashboard|reload-on-kill ()
  "If this isn't a dashboard buffer, move along, but record its
