ui/doom-dashboard: reload dashboard in daemon frames

Fixes an issue where creating a graphical frame from the daemon can
cause the non-GUI version of the dashboard to show.
This commit is contained in:
Henrik Lissner 2018-10-17 14:49:35 -04:00
parent c6c3054fbb
commit 5a442932d7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -200,7 +200,9 @@ PLIST can have the following properties:
(add-hook 'persp-created-functions #'+doom-dashboard|record-project)
(add-hook 'persp-activated-functions #'+doom-dashboard|detect-project)
(add-hook 'persp-before-switch-functions #'+doom-dashboard|record-project))
(+doom-dashboard-reload t))
(if (daemonp)
(add-hook 'after-make-frame-functions #'+doom-dashboard|reload-frame)
(+doom-dashboard-reload t)))
(defun +doom-dashboard|reload-on-kill ()
"A `kill-buffer-query-functions' hook. If this isn't a dashboard buffer, move
@ -218,6 +220,11 @@ If this is the dashboard buffer, reload the dashboard."
(let (+doom-dashboard-inhibit-refresh)
(ignore-errors (+doom-dashboard-reload))))))
(defun +doom-dashboard|reload-frame (_frame)
"Reload the dashboard after a brief pause. This is necessary for new frames,
whose dimensions may not be fully initialized by the time this is run."
(run-with-timer 0.1 nil #'+doom-dashboard-reload t))
(defun +doom-dashboard|resize (&rest _)
"Recenter the dashboard, and reset its margins and fringes."
(let ((windows (get-buffer-window-list (doom-fallback-buffer) nil t)))