 ;; Bootstrap
 ;;
 
-(doom-set-modeline 'main t)
+(doom-set-modeline 'main t) ; set default modeline
 
 (add-hook 'doom-init-theme-hook #'+doom-modeline|init)
 (add-hook 'doom-scratch-buffer-hook #'+doom-modeline|set-special-modeline)

        (buffer-file-truename (or buffer-file-truename "")))
    (propertize
     (pcase +doom-modeline-buffer-file-name-style
       ('truncate-upto-project (+doom-modeline--buffer-file-name 'shrink))
       ('truncate-upto-root (+doom-modeline--buffer-file-name-truncate))
       ('truncate-all (+doom-modeline--buffer-file-name-truncate t))
       ('relative-to-project (+doom-modeline--buffer-file-name-relative))
       ('relative-from-project (+doom-modeline--buffer-file-name-relative 'include-project))
       ('file-name (propertize (file-name-nondirectory buffer-file-name)
                               'face
                               (let ((face (or (and (buffer-modified-p)
                                                    'doom-modeline-buffer-modified)

(add-hook 'image-mode-hook #'+doom-modeline|set-media-modeline)
(add-hook 'circe-mode-hook #'+doom-modeline|set-special-modeline)

;; Ensure modeline is inactive when Emacs is unfocused (and active otherwise)
(defvar +doom-modeline-remap-face-cookie nil)
(defun +doom-modeline|focus ()
  (when +doom-modeline-remap-face-cookie
    (require 'face-remap)
    (face-remap-remove-relative +doom-modeline-remap-face-cookie)))
(defun +doom-modeline|unfocus ()
  (setq +doom-modeline-remap-face-cookie (face-remap-add-relative 'mode-line 'mode-line-inactive)))

(add-hook 'focus-in-hook #'+doom-modeline|focus)
