From 5a442932d716c65a619957d76dc23ed9a32ad8e7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 17 Oct 2018 14:49:35 -0400 Subject: [PATCH] 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. --- modules/ui/doom-dashboard/config.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/ui/doom-dashboard/config.el b/modules/ui/doom-dashboard/config.el index c53a018f6..a53f0704e 100644 --- a/modules/ui/doom-dashboard/config.el +++ b/modules/ui/doom-dashboard/config.el @@ -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)))