Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set dashboard-banner-logo-title to a function. #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

functionreturnfunction
Copy link

Simple callback functionality for the logo title; I had the idea when I read this post and decided against using hooks because one of my custom dashboard items is a little expensive to run so I don't want to run it twice.

@rakanalh
Copy link
Contributor

Hey @functionreturnfunction, could you show me a use-case for this? i would go for hooks being an idiom in the emacs community vs having callbacks for values that only set a string.

@functionreturnfunction
Copy link
Author

functionreturnfunction commented Jan 31, 2019

@rakanalh I'm using it to display start time/GC stats, and subsequently last refresh time, like so:

(let ((called 0))
    (defun my-dashboard-banner ()
      "Return a string including current date/time as well as information on
startup time and garbage collections.  Subsequent calls only return a string
containing the current date/time."
      (if (< 1 called)
          (format "Last refreshed at %s" (current-time-string))
        (setq called (1+ called))
        (format "Emacs ready at %s in %.2f seconds with %d garbage collections."
                (current-time-string)
                (float-time (time-subtract after-init-time before-init-time))
                gcs-done))))

(setq dashboard-banner-logo-title #'my-dashboard-banner)

'after-init-time' can't be derived before dashboard is initialized, which is why OP in the post I linked adds 'dashboard-refresh-buffer' to 'after-init-hook' to refresh the dashboard a second time. That would be a bit expensive for me because I have some custom widgets.

@belak
Copy link

belak commented Nov 6, 2019

I really wanted a way to specify just a title, rather than a PNG logo. It looks like this would support that... what would need to be done to get this in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants