Use left-margin to center dashboard elements #192

This commit is contained in:
Henrik Lissner 2017-09-09 18:38:55 +02:00
parent c4ea986f5a
commit a6199b1ed2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -116,15 +116,20 @@ whose dimensions may not be fully initialized by the time this is run."
(or (and (featurep! :ui doom-modeline)
(doom-modeline 'project))
mode-line-format)))
(let ((old-pwd (or dir default-directory)))
(with-current-buffer (doom-fallback-buffer)
(let ((+doom-dashboard--width 80)
(old-pwd (or dir default-directory))
(fallback-buffer (doom-fallback-buffer)))
(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))))
(with-current-buffer fallback-buffer
(with-silent-modifications
(unless (eq major-mode '+doom-dashboard-mode)
(+doom-dashboard-mode))
(erase-buffer)
(setq default-directory old-pwd)
(let ((+doom-dashboard--width (window-width))
(+doom-dashboard--height (window-height)))
(let ((+doom-dashboard--height (window-height)))
(insert (make-string (max 0 (- (truncate (/ +doom-dashboard--height 2)) 16)) ?\n))
(dolist (widget-name +doom-dashboard-widgets)
(funcall (intern (format "doom-dashboard-widget--%s" widget-name)))