aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el10
-rw-r--r--lisp/ui/init-fonts.el70
-rw-r--r--lisp/ui/init-modeline.el46
-rw-r--r--lisp/ui/init-theme.el29
-rw-r--r--lisp/ui/init-windows.el73
5 files changed, 228 insertions, 0 deletions
diff --git a/init.el b/init.el
index c6e4b00..8ba4bcb 100644
--- a/init.el
+++ b/init.el
@@ -67,6 +67,16 @@
;; ------------------------------------------------------------
+;; UI modules
+;; ------------------------------------------------------------
+
+(require 'init-fonts)
+(require 'init-theme)
+(require 'init-modeline)
+(require 'init-windows)
+
+
+;; ------------------------------------------------------------
;; Custom settings
;; ------------------------------------------------------------
diff --git a/lisp/ui/init-fonts.el b/lisp/ui/init-fonts.el
new file mode 100644
index 0000000..ec4f8f4
--- /dev/null
+++ b/lisp/ui/init-fonts.el
@@ -0,0 +1,70 @@
+;;; init-fonts.el --- Font configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure fonts for graphical Emacs frames.
+;; Use JetBrains Mono for Latin text and code.
+;; Prefer Noto Sans CJK SC for Chinese characters.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Font settings
+;; ------------------------------------------------------------
+
+(defvar my/default-font-family "JetBrains Mono"
+ "Preferred font family for code and Latin text.")
+
+(defvar my/cjk-font-family "Noto Sans CJK SC"
+ "Preferred font family for CJK characters.")
+
+(defvar my/default-font-height 130
+ "Default font height in units of 1/10 point.")
+
+
+;; ------------------------------------------------------------
+;; Apply fonts
+;; ------------------------------------------------------------
+
+(defun my/apply-fonts (&optional frame)
+ "Configure fonts for graphical FRAME."
+ (with-selected-frame (or frame (selected-frame))
+ (when (display-graphic-p)
+
+ ;; Default font.
+ (when (find-font
+ (font-spec :family my/default-font-family))
+ (set-face-attribute
+ 'default (selected-frame)
+ :family my/default-font-family
+ :height my/default-font-height))
+
+ ;; Chinese font.
+ (when (find-font
+ (font-spec :family my/cjk-font-family))
+ (set-fontset-font
+ nil 'han
+ (font-spec :family my/cjk-font-family)
+ nil 'prepend)))))
+
+
+;; ------------------------------------------------------------
+;; Initialize
+;; ------------------------------------------------------------
+
+;; Apply to the current frame.
+(my/apply-fonts)
+
+;; Apply to new frames, including emacsclient GUI frames.
+(add-hook 'after-make-frame-functions #'my/apply-fonts)
+
+
+(provide 'init-fonts)
+
+;;; init-fonts.el ends here
diff --git a/lisp/ui/init-modeline.el b/lisp/ui/init-modeline.el
new file mode 100644
index 0000000..f78f0f5
--- /dev/null
+++ b/lisp/ui/init-modeline.el
@@ -0,0 +1,46 @@
+;;; init-modeline.el --- Mode line configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure the Emacs mode line using doom-modeline.
+;; Display buffer, file, project, and editing information.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Doom Modeline
+;; ------------------------------------------------------------
+
+(use-package doom-modeline
+ :ensure t
+ :demand t
+
+ :custom
+ ;; Mode line height in graphical Emacs.
+ (doom-modeline-height 28)
+
+ ;; Disable icons until Nerd Fonts are configured.
+ (doom-modeline-icon nil)
+
+ ;; Display file encoding information.
+ (doom-modeline-buffer-encoding t)
+
+ ;; Display project information.
+ (doom-modeline-project-name t)
+
+ ;; Display buffer modification status.
+ (doom-modeline-highlight-modified-buffer-name t)
+
+ :config
+ (doom-modeline-mode 1))
+
+
+(provide 'init-modeline)
+
+;;; init-modeline.el ends here
diff --git a/lisp/ui/init-theme.el b/lisp/ui/init-theme.el
new file mode 100644
index 0000000..abbd8d4
--- /dev/null
+++ b/lisp/ui/init-theme.el
@@ -0,0 +1,29 @@
+;;; init-theme.el --- Theme configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure the graphical appearance of Emacs.
+;; Use the Tokyo Night color theme.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Tokyo Night
+;; ------------------------------------------------------------
+
+(use-package tokyo-night
+ :ensure t
+ :demand t
+ :config
+ (load-theme 'tokyo-night-storm t))
+
+
+(provide 'init-theme)
+
+;;; init-theme.el ends here
diff --git a/lisp/ui/init-windows.el b/lisp/ui/init-windows.el
new file mode 100644
index 0000000..239d022
--- /dev/null
+++ b/lisp/ui/init-windows.el
@@ -0,0 +1,73 @@
+;;; init-windows.el --- Window management -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure Emacs window and tab management.
+;; Enable tab-bar-mode and winner-mode.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Tab Bar
+;; ------------------------------------------------------------
+
+(require 'tab-bar)
+
+;; Show the tab bar when multiple tabs exist.
+(setq tab-bar-show 1)
+
+;; Hide additional tab control buttons.
+(setq tab-bar-new-button-show nil)
+(setq tab-bar-close-button-show nil)
+
+;; Enable tab management.
+(tab-bar-mode 1)
+
+
+;; ------------------------------------------------------------
+;; Winner Mode
+;; ------------------------------------------------------------
+
+(require 'winner)
+
+;; Enable window layout history.
+(winner-mode 1)
+
+
+;; ------------------------------------------------------------
+;; Keybindings
+;; ------------------------------------------------------------
+
+;; Create a new tab.
+(define-key my/command-map
+ (kbd "t")
+ #'tab-new)
+
+;; Switch tabs.
+(define-key my/command-map
+ (kbd "n")
+ #'tab-next)
+
+(define-key my/command-map
+ (kbd "p")
+ #'tab-previous)
+
+;; Restore window layouts.
+(define-key my/command-map
+ (kbd "u")
+ #'winner-undo)
+
+(define-key my/command-map
+ (kbd "U")
+ #'winner-redo)
+
+
+(provide 'init-windows)
+
+;;; init-windows.el ends here