                             :face 'doom-modeline-warning
                             :v-adjust -0.05)
                            " ")))
-            (when-let (dir-path (+doom-modeline--buffer-path))
-              (if-let (faces (or faces (if active 'doom-modeline-buffer-path)))
-                  (propertize dir-path 'face `(:inherit ,faces))
-                dir-path))
-            (when-let (file-path (+doom-modeline--buffer-file))
-              (if-let (faces (or faces (if active 'doom-modeline-buffer-file)))
-                  (propertize file-path 'face `(:inherit ,faces))
-                file-path)))))
+            (if buffer-file-name
+                (+doom-modeline-buffer-file-name)
+              "%b"))))
 
 ;;
 (def-modeline-segment! buffer-info-simple

(advice-add #'handle-switch-frame :after #'+doom-modeline|set-selected-window)
(advice-add #'select-window :after #'+doom-modeline|set-selected-window)



;;

                               (if (eq idx len) "\"};" "\",\n")))))
      'xpm t :ascent 'center))))

(defun +doom-modeline-buffer-file-name ()
  "Propertized `buffer-file-name' that truncates less significant parts of path
but displays abbreviated path in minibuffer on mouse-over."
  (propertize (+doom-modeline--buffer-file-name 'shrink)
              'help-echo (+doom-modeline--buffer-file-name nil)))

(defun +doom-modeline--buffer-file-name (truncate-project-root-parent)
  "Propertized `buffer-file-name'.
If TRUNCATE-PROJECT-ROOT-PARENT is t space will be saved by truncating it down
fish-shell style.

Example:
~/Projects/FOSS/emacs/lisp/comint.el => ~/P/F/emacs/lisp/comint.el"
  (let* ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified))
         (active (active))
         (project-root (doom-project-root))
         (file-name-split (shrink-path-file-mixed project-root
                                                  (file-name-directory
                                                   (or buffer-file-truename
                                                       (file-truename buffer-file-name)))
                                                  (file-truename buffer-file-name)))
         propertized-file-name)
    (if (null file-name-split) "%b"
      (pcase-let ((`(,root-path-parent ,project ,relative-path ,filename) file-name-split))
        (let ((sp-faces `(:inherit ,(or modified-faces (if active 'font-lock-comment-face))
                          ,@(if active '(:weight bold))))
              (project-faces `(:inherit ,(or modified-faces (if active 'font-lock-string-face))
                               ,@(if active '(:weight bold))))
              (relative-faces `(:inherit ,(or modified-faces (if active 'doom-modeline-buffer-path))))
              (file-faces `(:inherit ,(or modified-faces (if active 'doom-modeline-buffer-file)))))
          (concat (propertize (if truncate-project-root-parent
                                  root-path-parent
                                (abbreviate-file-name project-root))
                              'face sp-faces)
                  (propertize (concat project "/") 'face project-faces)
                  (when relative-path (propertize relative-path 'face relative-faces))
                  (propertize filename 'face file-faces)))))))
;;
;; Segments
;;
