dotfiles/emacs/.emacs.d/config/init-mac.el

45 lines
1.2 KiB
EmacsLisp

;; -*- lexical-binding: t; -*-
(defcustom my-light-theme 'doom-solarized-light
"My light theme."
:type 'symbol
:group 'personal
:options (custom-available-themes))
(defcustom my-dark-theme 'doom-solarized-dark
"My dark theme."
:type 'symbol
:group 'personal
:options (custom-available-themes))
(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)
(use-package ultra-scroll-mac
:straight (:type git :host github :repo "jdtsmith/ultra-scroll-mac")
:hook (after-init . ultra-scroll-mac-mode))
(unbind-key "C-<tab>" global-map)
(unbind-key "C-S-<tab>" global-map)
(provide 'init-mac)