Emacs

Project: https://www.gnu.org/software/emacs/

Setup

A small snippet of Emacs Lisp is required, but no external dependencies are required otherwise:

  1. Replace your existing load-theme call with this snippet:
(let ((thcon-emacs-el "~/.local/share/thcon/emacs.el"))
(require 'filenotify)

(defun reload-thcon-config (event)
(when (file-readable-p (nth 2 event))
(load-file (nth 2 event))))

(file-notify-add-watch
thcon-emacs-el '(change) 'reload-thcon-config)

(when (file-readable-p thcon-emacs-el)
(load-file thcon-emacs-el)))
  1. Split your dark mode and light mode configs into separate .el files
  2. Use the paths to those files in thcom.toml (examples below)

In other words:

 ; ~/.emacs.d/init.el
-(load-theme 'tango)
+(let ((thcon-emacs-el "~/.local/share/thcon/emacs.el"))
+ (require 'filenotify)

+(defun reload-thcon-config (event)
+ (when (file-readable-p (nth 2 event))
+ (load-file (nth 2 event))))

+(file-notify-add-watch
+ thcon-emacs-el '(change) 'reload-thcon-config)

+(when (file-readable-p thcon-emacs-el)
+ (load-file thcon-emacs-el)))
; ~/.emacs.d/dark.thcon.el

(load-theme 'tsdh-dark)
; ...
; ~/.emacs.d/light.thcon.el

(load-theme 'tsdh-light)
; ...

Configuration

Section: [emacs]

Configuration keys, defaults, and descriptions
Key Default Description
dark (none)

Path to the file defining dark mode settings

light (none)

Path to the file defining light mode settings

disabled false Disables Emacs

Example

[emacs]
dark = "~/.emacs.d/dark.thcon.el"
light = "~/.emacs.d/light.thcon.el"