Add mac-specific emacs config

This commit is contained in:
Jeremy Dormitzer 2022-05-31 14:09:33 -04:00
parent 2c90886299
commit 55cc23b13f
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,28 @@
;; -*- lexical-binding: t; -*-
(defvar my-light-theme 'jdormit-doom-solarized-light)
(defvar my-dark-theme 'doom-solarized-dark)
(defun mac-appearance () (plist-get (mac-application-state) :appearance))
(defun dark-theme-enabled? ()
(string-equal (mac-appearance)
"NSAppearanceNameDarkAqua"))
(defun set-theme-from-system ()
(if (dark-theme-enabled?)
(consult-theme my-dark-theme)
(consult-theme my-light-theme)))
(defvar theme-timer-status-cache (mac-appearance))
(defun theme-timer-fn ()
(let ((appearance (mac-appearance)))
(when (not (string-equal appearance theme-timer-status-cache))
(set-theme-from-system)
(setq theme-timer-status-cache appearance))))
(defun theme-timer-hook ()
(run-at-time "2 sec" 2 #'theme-timer-fn))
(add-hook 'after-init-hook #'theme-timer-hook)
(provide 'init-mac)

View File

@ -94,6 +94,7 @@
(require 'init-js)
(require 'init-rust)
(require 'init-web)
(require 'init-swift)
(require 'init-xml)
(require 'init-yaml)
(require 'init-groovy)
@ -113,6 +114,8 @@
(require 'init-wallabag)
(require 'init-lola)
(require 'handwriting)
(when (string-equal system-type "darwin")
(require 'init-mac))
(load (expand-file-name (concat user-emacs-directory "local.el")) 'noerror 'nomessage)