Add image banner display logic to dashboard

But disabled by default (until the logo is ready).
This commit is contained in:
Henrik Lissner 2018-07-04 16:19:30 +02:00
parent e37e6fc25c
commit ee4060ab80
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -92,7 +92,7 @@ PLIST can have the following properties:
;;
(defvar +doom-dashboard--last-cwd nil)
(defvar +doom-dashboard--width 80)
(defvar +doom-dashboard--height 0)
(defvar +doom-dashboard--hoffset 2)
(defvar +doom-dashboard--old-fringe-indicator fringe-indicator-alist)
(defvar +doom-dashboard--pwd-alist ())
@ -240,9 +240,10 @@ whose dimensions may not be fully initialized by the time this is run."
(point)))
(insert (make-string
(max 0 (- (/ (window-height (get-buffer-window)) 2)
(truncate (/ (count-lines (point-min) (point-max))
2))
2)) ?\n)
(truncate (/ (+ (count-lines (point-min) (point-max))
+doom-dashboard--hoffset)
2))))
?\n)
"\n")))))))
(defun +doom-dashboard|detect-project (&rest _)
@ -345,6 +346,7 @@ controlled by `+doom-dashboard-pwd-policy'."
;;
(defun doom-dashboard-widget-banner ()
(let ((point (point)))
(mapc (lambda (line)
(insert (propertize (+doom-dashboard--center +doom-dashboard--width line)
'face 'font-lock-comment-face) " ")
@ -367,7 +369,21 @@ controlled by `+doom-dashboard-pwd-policy'."
"||.==' _-' `' | /==.||"
"==' _-' E M A C S \\/ `=="
"\\ _-' `-_ /"
" `'' ``'")))
" `'' ``'"))
;; TODO Add Doom logo
;; (when (display-graphic-p)
;; (let* ((image (create-image "~/title.png" 'png nil))
;; (size (image-size image))
;; (margin (+ 1 (/ (- +doom-dashboard--width (car size)) 2))))
;; (setq +doom-dashboard--hoffset (cdr size))
;; (add-text-properties
;; point (point) `(display ,image rear-nonsticky (display)))
;; (when (> margin 0)
;; (save-excursion
;; (goto-char point)
;; (insert (make-string (truncate margin) ? )))))
;; (insert "\n\n\n"))
))
(defun doom-dashboard-widget-loaded ()
(insert