diff --git a/README.org b/README.org index 461068f5..33a4e8fb 100644 --- a/README.org +++ b/README.org @@ -107,6 +107,26 @@ To show info about the packages loaded and the init time: (setq dashboard-set-init-info t) #+END_SRC +Also, the message can be customized like this: +#+BEGIN_SRC elisp + (setq dashboard-init-info "This is an init message!") +#+END_SRC + +A randomly selected footnote will be displayed. To disable it: +#+BEGIN_SRC elisp + (setq dashboard-set-footer nil) +#+END_SRC + +To customize it and customize its icon; + +#+BEGIN_SRC elisp + (setq dashboard-footer "Dashboard is pretty cool!") + (setq dashboard-footer-icon (all-the-icons-octicon "dashboard" + :height 1.1 + :v-adjust -0.05 + :face 'font-lock-keyword-face)) +#+END_SRC + ** Org mode’s agenda To display today’s agenda items on the dashboard, add ~agenda~ to ~dashboard-items~: diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 2678308b..9f3151b2 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -44,7 +44,6 @@ to the specified width, with aspect ratio preserved." :type 'integer :group 'dashboard) - (defcustom dashboard-set-heading-icons nil "When non nil, heading sections will have icons." :type 'boolean @@ -60,6 +59,11 @@ to the specified width, with aspect ratio preserved." :type 'boolean :group 'dashboard) +(defcustom dashboard-set-footer t + "When non nil, a footer will be displayed at the bottom." + :type 'boolean + :group 'dashboard) + (defcustom dashboard-show-shortcuts t "Whether to show shortcut keys for each section." :type 'boolean @@ -88,6 +92,27 @@ to the specified width, with aspect ratio preserved." (length package-activated-list) (emacs-init-time)) "Init info with packages loaded and init time.") +(defvar dashboard-footer + (let ((list '("The one true editor, Emacs!" + "Who the hell uses VIM anyway? Go Evil!" + "Free as free speech, free as free Beer" + "Richard Stallman is proud of you" + "Happy coding!" + "Vi Vi Vi, the editor of the beast" + "Welcome to the church of Emacs" + "While any text editor can save your files,\ + only Emacs can save your soul" + "I showed you my source code,pls respond" + ))) + (nth (random (1- (1+ (length list)))) list)) + "A footer with some short message.") + +(defvar dashboard-footer-icon (all-the-icons-fileicon "emacs" + :height 1.1 + :v-adjust -0.05 + :face 'font-lock-keyword-face) + "Footer's icon.") + (defvar dashboard-startup-banner 'official "Specify the startup banner. Default value is `official', it displays @@ -133,7 +158,7 @@ If nil it is disabled. Possible values for list-type are: ;; Faces ;; (defface dashboard-text-banner - '((t :inherit default)) + '((t (:inherit font-lock-keyword-face))) "Face used for text banners." :group 'dashboard) @@ -230,6 +255,11 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (insert (propertize heading 'face 'dashboard-heading)) (if shortcut (insert (format " (%s)" shortcut)))) +(defun dashboard-center-line (string) + "Center a STRING accoring to it's size." + (insert (make-string (max 0 (floor (/ (- dashboard-banner-length + (+ (length string) 1)) 2))) ?\ ))) + ;; ;; BANNER ;; @@ -275,14 +305,18 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (insert-image spec) (insert "\n\n") (when title - (insert (make-string (max 0 (floor (/ (- dashboard-banner-length - (+ (length title) 1)) 2))) ?\ )) - (insert (format "%s\n\n" (propertize title 'face 'dashboard-banner-logo-title)))) - (when dashboard-set-init-info - (insert (make-string (max 0 (floor (/ (- dashboard-banner-length - (+ (length dashboard-init-info) 1)) 2))) ?\ )) - (insert (concat - (propertize dashboard-init-info 'face 'font-lock-comment-face))))))) + (dashboard-center-line title) + (insert (format "%s\n\n" (propertize title 'face 'dashboard-banner-logo-title))))))) + +;; +;; INIT INFO +;; +(defun dashboard-insert-init-info () + "Insert init info when dashboard-set-init-info is t." + (when dashboard-set-init-info + (dashboard-center-line dashboard-init-info) + (insert + (propertize dashboard-init-info 'face 'font-lock-comment-face)))) (defun dashboard-get-banner-path (index) "Return the full path to banner with index INDEX." @@ -321,8 +355,8 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (when banner (if (image-type-available-p (intern (file-name-extension banner))) (dashboard-insert-image-banner banner) - (dashboard-insert-ascii-banner-centered banner)))))) - + (dashboard-insert-ascii-banner-centered banner)) + (dashboard-insert-init-info))))) (defmacro dashboard-insert-section (section-name list list-size shortcut action &rest widget-params) "Add a section with SECTION-NAME and LIST of LIST-SIZE items to the dashboard. @@ -389,6 +423,17 @@ WIDGET-PARAMS are passed to the \"widget-create\" function." :format "%[%t%]"))) ,list))) +;; Footer +(defun dashboard-insert-footer () + "Insert footer of dashboard." + (when dashboard-set-footer + (insert "\n") + (dashboard-center-line dashboard-footer) + (when (display-graphic-p) + (insert dashboard-footer-icon)) + (insert " ") + (insert (propertize dashboard-footer 'face 'font-lock-doc-face)))) + ;; ;; Recentf ;; diff --git a/dashboard.el b/dashboard.el index 3336abdf..5b16d045 100644 --- a/dashboard.el +++ b/dashboard.el @@ -186,7 +186,8 @@ Optional prefix ARG says how many lines to move; default is one line." (while (not (eobp)) (and (not (eq ? (char-after))) (insert (make-string margin ?\ ))) - (forward-line 1))))) + (forward-line 1)))) + (dashboard-insert-footer)) (dashboard-mode) (goto-char (point-min)))) (if recentf-is-on diff --git a/screenshot.png b/screenshot.png index 39ac9ac1..74603fb0 100644 Binary files a/screenshot.png and b/screenshot.png differ