 (defsubst active ()
   (eq (selected-window) +doom-modeline-current-window))
 
-;; Inspired from `powerline's `pl/make-xpm'.
 (defun +doom-modeline--make-xpm (face width height)
-  "Create an XPM bitmap."
+  "Create an XPM bitmap. Inspired by `powerline''s `pl/make-xpm'."
   (propertize
    " " 'display
    (let ((data (make-list height (make-list width 1)))

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

;; TODO Refactor me
(defvar +doom-modeline-remap-face-cookie nil)
(defun +doom-modeline|focus ()
  (require 'face-remap)
  (when +doom-modeline-remap-face-cookie
    (face-remap-remove-relative +doom-modeline-remap-face-cookie)))

(defun +doom-modeline|unfocus ()
  (require 'face-remap)
  (setq +doom-modeline-remap-face-cookie (face-remap-add-relative 'mode-line 'mode-line-inactive)))

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

;; Bootstrap
;;

(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)
