Add official logo to startup page
This commit is contained in:
parent
426ad1a4bc
commit
0052466422
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
|
@ -17,12 +17,12 @@
|
|||
"List of additional paths where to look for configuration layers.
|
||||
Paths must have a trailing slash (ie. `~/.mycontribs/')")
|
||||
|
||||
(defvar dotspacemacs-startup-banner 'random
|
||||
"Specify the startup banner. If the value is an integer then the
|
||||
text banner with the corresponding index is used, if the value is
|
||||
`random' then the banner is chosen randomly among the available banners,
|
||||
if the value is a string then it must be a path to a .PNG file,
|
||||
if the value is nil then no banner is displayed.")
|
||||
(defvar dotspacemacs-startup-banner 'official
|
||||
"Specify the startup banner. Default value is `official', it displays
|
||||
the official spacemacs logo. An integer value is the index of text
|
||||
banner, `random' chooses a random text banner in `core/banners'
|
||||
directory. A string value must be a path to a .PNG file.
|
||||
If the value is nil then no banner is displayed.")
|
||||
|
||||
(defvar dotspacemacs-configuration-layers '()
|
||||
"List of configuration layers to load. If it is the symbol `all' instead
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
(defconst spacemacs-banner-directory
|
||||
(expand-file-name (concat spacemacs-core-directory "banners/"))
|
||||
"Spacemacs banners directory.")
|
||||
(defconst spacemacs-banner-official-png
|
||||
(expand-file-name (concat spacemacs-banner-directory "img/spacemacs.png"))
|
||||
"Spacemacs official banner image.")
|
||||
(defconst spacemacs-directory
|
||||
(expand-file-name (concat user-emacs-directory "spacemacs/"))
|
||||
"Spacemacs base directory.")
|
||||
|
|
|
@ -12,30 +12,34 @@
|
|||
(defconst spacemacs-buffer-name "*spacemacs*"
|
||||
"The name of the spacemacs buffer.")
|
||||
|
||||
(defun spacemacs//insert-banner ()
|
||||
"Choose a banner and insert in spacemacs buffer.
|
||||
(defconst spacemacs--banner-length 75
|
||||
"Width of a banner.")
|
||||
|
||||
Doge special banner can be reachable via `999', `doge' or `random*'.
|
||||
(defun spacemacs//insert-banner-and-buttons ()
|
||||
"Choose a banner accordingly to `dotspacemacs-startup-banner'and insert it
|
||||
in spacemacs buffer along whith quick buttons underneath.
|
||||
|
||||
Easter egg:
|
||||
Doge special text banner can be reachable via `999', `doge' or `random*'.
|
||||
`random' ignore special banners whereas `random*' does not."
|
||||
(let ((banner (spacemacs//choose-banner))
|
||||
(buffer-read-only nil))
|
||||
(when banner
|
||||
(spacemacs/message (format "Banner: %s" banner))
|
||||
(if (string-match "\\.png\\'" banner)
|
||||
(progn
|
||||
(insert " ")
|
||||
(insert-image (create-image banner))
|
||||
(insert (format "%s" spacemacs-version))
|
||||
(insert "\n"))
|
||||
(progn
|
||||
(insert-file-contents banner)
|
||||
(spacemacs//inject-version-in-buffer)))
|
||||
(spacemacs/insert-buttons)
|
||||
(spacemacs//redisplay))))
|
||||
(spacemacs//insert-image-banner banner)
|
||||
(insert-file-contents banner))
|
||||
(spacemacs//inject-version)
|
||||
(spacemacs/insert-buttons)
|
||||
(spacemacs//redisplay))))
|
||||
|
||||
(defun spacemacs//choose-banner ()
|
||||
"Return the full path of a banner based on the dotfile value."
|
||||
(cond
|
||||
((eq 'official dotspacemacs-startup-banner)
|
||||
(if (and (display-graphic-p) (image-type-available-p 'png))
|
||||
spacemacs-banner-official-png
|
||||
(spacemacs//get-banner-path 1)))
|
||||
((eq 'random dotspacemacs-startup-banner)
|
||||
(spacemacs//choose-random-text-banner))
|
||||
((eq 'random* dotspacemacs-startup-banner)
|
||||
|
@ -44,8 +48,9 @@ Doge special banner can be reachable via `999', `doge' or `random*'.
|
|||
(spacemacs//get-banner-path 999))
|
||||
((integerp dotspacemacs-startup-banner)
|
||||
(spacemacs//get-banner-path dotspacemacs-startup-banner))
|
||||
((string-match "\\.png\\'" dotspacemacs-startup-banner)
|
||||
(if (image-type-available-p 'png)
|
||||
((and dotspacemacs-startup-banner
|
||||
(string-match "\\.png\\'" dotspacemacs-startup-banner))
|
||||
(if (and (display-graphic-p) (image-type-available-p 'png))
|
||||
(if (file-exists-p dotspacemacs-startup-banner)
|
||||
dotspacemacs-startup-banner
|
||||
(spacemacs/message (format "Warning: could not find banner %s"
|
||||
|
@ -67,12 +72,26 @@ If ALL is non-nil then truly all banners can be selected."
|
|||
"Return the full path to banner with index INDEX."
|
||||
(concat spacemacs-banner-directory (format "%03d-banner.txt" index)))
|
||||
|
||||
(defun spacemacs//inject-version-in-buffer ()
|
||||
(defun spacemacs//insert-image-banner (banner)
|
||||
"Display an image banner."
|
||||
(when (file-exists-p banner)
|
||||
(let* ((spec (create-image banner))
|
||||
(size (image-size spec))
|
||||
(width (car size))
|
||||
(left-margin (floor (- spacemacs--banner-length width) 2)))
|
||||
(beginning-of-buffer)
|
||||
(insert "\n")
|
||||
(insert (make-string (- left-margin 1) ?\ ))
|
||||
(insert-image spec)
|
||||
(insert "\n\n")
|
||||
(insert " [S P A C E M A C S]\n\n"))))
|
||||
|
||||
(defun spacemacs//inject-version ()
|
||||
"Inject the current version of spacemacs in the first line of the
|
||||
buffer, right justified."
|
||||
(save-excursion
|
||||
(beginning-of-buffer)
|
||||
(let* ((maxcol spacemacs-title-length)
|
||||
(let* ((maxcol spacemacs--banner-length)
|
||||
(injected (format "(%s)" spacemacs-version))
|
||||
(pos (- maxcol (length injected)))
|
||||
(buffer-read-only nil))
|
||||
|
@ -110,9 +129,7 @@ buffer, right justified."
|
|||
(setq mode-line-format "")))
|
||||
|
||||
(defun spacemacs/loading-animation ()
|
||||
"Display LOADING-TITLE with trailing dots of max length
|
||||
SPACEMACS-TITLE-LENGTH. New loading title is displayed by chunk
|
||||
of size LOADING-DOTS-CHUNK-THRESHOLD."
|
||||
"Display the progress bar by chunk of size `spacemacs--loading-dots-chunk-threshold'."
|
||||
(when dotspacemacs-loading-progress-bar
|
||||
(setq spacemacs-loading-counter (1+ spacemacs-loading-counter))
|
||||
(when (>= spacemacs-loading-counter spacemacs-loading-dots-chunk-threshold)
|
||||
|
@ -147,9 +164,9 @@ of size LOADING-DOTS-CHUNK-THRESHOLD."
|
|||
(lambda (b) (call-interactively 'configuration-layer/rollback))
|
||||
'follow-link t 'help-echo "Rollback ELPA package upgrades if something got borked.")
|
||||
(insert "\n")
|
||||
(let ((button-title "[Search Spacemacs]"))
|
||||
(let ((button-title "[Search in Spacemacs]"))
|
||||
; Compute the correct number of spaces to center the button.
|
||||
(dotimes (i (/ (- spacemacs-title-length (string-width button-title)) 2)) (insert " "))
|
||||
(dotimes (i (/ (- spacemacs--banner-length (string-width button-title) 1) 2)) (insert " "))
|
||||
(insert-button button-title 'action
|
||||
(lambda (b) (call-interactively 'helm-spacemacs)) 'follow-link t
|
||||
'help-echo "Find Spacemacs package and layer configs using helm-spacemacs."))
|
||||
|
@ -159,9 +176,10 @@ of size LOADING-DOTS-CHUNK-THRESHOLD."
|
|||
(defun spacemacs/goto-link-line ()
|
||||
"Move the point to the beginning of the link line."
|
||||
(interactive)
|
||||
(with-current-buffer spacemacs-buffer-name
|
||||
(goto-char (point-min))
|
||||
(re-search-forward "Homepage")
|
||||
(beginning-of-line)))
|
||||
(when dotspacemacs-startup-banner
|
||||
(with-current-buffer spacemacs-buffer-name
|
||||
(goto-char (point-min))
|
||||
(re-search-forward "Homepage")
|
||||
(beginning-of-line))))
|
||||
|
||||
(provide 'core-spacemacs-buffer)
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
"Text displayed in the mode-line when a new version is available.")
|
||||
|
||||
;; loading progress bar variables
|
||||
(defvar spacemacs-title-length 75)
|
||||
(defvar spacemacs-loading-char ?█)
|
||||
(defvar spacemacs-loading-string "")
|
||||
(defvar spacemacs-loading-counter 0)
|
||||
|
@ -107,7 +106,7 @@ initialization."
|
|||
(spacemacs/message "Warning: Cannot find font \"%s\"!"
|
||||
(car dotspacemacs-default-font)))
|
||||
;; banner
|
||||
(spacemacs//insert-banner)
|
||||
(spacemacs//insert-banner-and-buttons)
|
||||
(setq-default evil-want-C-u-scroll t)
|
||||
;; Initializing configuration from ~/.spacemacs
|
||||
(dotspacemacs|call-func dotspacemacs/init "Executing user init...")
|
||||
|
@ -325,7 +324,6 @@ version and the NEW version."
|
|||
;; Ultimate configuration decisions are given to the user who can defined
|
||||
;; them in his/her ~/.spacemacs file
|
||||
(dotspacemacs|call-func dotspacemacs/config "Calling dotfile config...")
|
||||
(message "%s" (window-width))
|
||||
;; from jwiegley
|
||||
;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
|
||||
(let ((elapsed (float-time
|
||||
|
|
|
@ -25,12 +25,13 @@ before layers configuration."
|
|||
;; This setq-default sexp is an exhaustive list of all the supported
|
||||
;; spacemacs settings.
|
||||
(setq-default
|
||||
;; Specify the startup banner. If the value is an integer then the
|
||||
;; text banner with the corresponding index is used, if the value is
|
||||
;; `random' then the banner is chosen randomly among the available banners,
|
||||
;; if the value is a string then it must be a path to a .PNG file,
|
||||
;; if the value is nil then no banner is displayed.
|
||||
dotspacemacs-startup-banner 'random
|
||||
;; Specify the startup banner. Default value is `official', it displays
|
||||
;; the official spacemacs logo. An integer value is the index of text
|
||||
;; banner, `random' chooses a random text banner in `core/banners'
|
||||
;; directory. A string value must be a path to a .PNG file.
|
||||
;; If the value is nil then no banner is displayed.
|
||||
;; dotspacemacs-startup-banner 'official
|
||||
dotspacemacs-startup-banner 'official
|
||||
;; List of themes, the first of the list is loaded when spacemacs starts.
|
||||
;; Press <SPC> T n to cycle to the next theme in the list (works great
|
||||
;; with 2 themes variants, one dark and one light)
|
||||
|
|
Loading…
Reference in New Issue