aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2025-02-21 23:15:05 +0000
committerGene Pasquet <dev@etenil.net>2025-02-21 23:16:55 +0000
commiteca8b380aad654bf37e00941b82e853f458c5f4d (patch)
treeac7ee88cbe2f4763f67c9d745dbef8bbb325765a
parent683697a12d7db49679b5c1562919593be7173e31 (diff)
Add custom home screen
-rw-r--r--.gitignore2
-rw-r--r--installer/early-init.el2
-rw-r--r--screenshots/substrate-home-screen.pngbin119866 -> 63690 bytes
-rw-r--r--substrate.el51
4 files changed, 47 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 20ce8bb..24bda80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
/auto-save-list/
/eshell/
/projects
+*~
+#*#
diff --git a/installer/early-init.el b/installer/early-init.el
index 151709f..c3c275b 100644
--- a/installer/early-init.el
+++ b/installer/early-init.el
@@ -1,4 +1,4 @@
;; ~/.emacs.d/early-init.el
-(add-to-list 'load-path "INSTALL_PATH")
+(add-to-list 'load-path "/home/gene/test-emacs/emacs-substrate")
(require 'early-substrate)
diff --git a/screenshots/substrate-home-screen.png b/screenshots/substrate-home-screen.png
index f4b83a9..c5bd39f 100644
--- a/screenshots/substrate-home-screen.png
+++ b/screenshots/substrate-home-screen.png
Binary files differ
diff --git a/substrate.el b/substrate.el
index aa02727..c58eb4b 100644
--- a/substrate.el
+++ b/substrate.el
@@ -31,9 +31,6 @@
(defcustom substrate-display-line-numbers t
"Display line numbers on buffers"
:type 'boolean :group 'substrate)
-(defcustom substrate-enable-cua-mode t
- "Enable CUA mode or not"
- :type 'boolean :group 'substrate)
(defcustom substrate-configure-theme t
"Configure the default theme (evangelion) as part of the substrate init"
:type 'boolean :group 'substrate)
@@ -54,6 +51,50 @@
(fmakunbound 'substrate--load-theme-daemon)))
(load-theme theme t)))
+(defun substrate--insert-centered-line (text)
+ (let ((window-width (window-width))
+ (text-width (length text)))
+ (dotimes (num (/ (- window-width text-width) 2))
+ (insert " "))
+ (insert text)
+ (insert "\n")
+ ))
+
+(defvar substrate--splash-screen-lines
+ '(" .⌒. "
+ " .# #. "
+ " / \\ "
+ " (,,,___,,,) "
+ " ) ( "
+ " (___) \n"
+
+
+ "Welcome to Emacs Substrate!\n\n\n\n"
+ "Quickstart:\n\n"
+ "←↑↓→ move around "
+ "Ctrl+x Ctrl+c quit "
+ "Ctrl+h t start the tutorial"
+ ))
+
+(defun substrate-splash-screen ()
+ (setq inhibit-startup-screen t)
+ (let ((splash-buffer (get-buffer-create "*GNU Emacs*")))
+ (with-current-buffer splash-buffer
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (setq default-directory nil)
+
+ (mapc #'substrate--insert-centered-line substrate--splash-screen-lines)
+
+ (set-buffer-modified-p nil)
+ (view-mode-enter nil 'kill-buffer)
+ (goto-char (point-min))
+
+ (switch-to-buffer splash-buffer)
+ ))))
+
+(add-hook 'emacs-startup-hook #'substrate-splash-screen)
+
(defun substrate-init ()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -221,10 +262,6 @@ If the new path's directories does not exist, create them."
(blink-cursor-mode -1) ; Steady cursor
(pixel-scroll-precision-mode) ; Smooth scrolling
- ;; Use common keystrokes by default
- (when substrate-enable-cua-mode
- (cua-mode))
-
;; Display line numbers in programming mode
(when substrate-display-line-numbers
(add-hook 'prog-mode-hook 'display-line-numbers-mode)