Skip to content

Commit

Permalink
fix: refresh ns-appearance while chaning mode on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Nov 10, 2024
1 parent 78359db commit c3fdf6f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lisp/init-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,24 @@
(setq frame-title-format '("Centaur Emacs - %b")
icon-title-format frame-title-format)

(when (and sys/mac-x-p sys/mac-ns-p sys/mac-port-p)
(when (or sys/mac-ns-p sys/mac-port-p)
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark))
(add-hook 'server-after-make-frame-hook
(lambda ()
(if (display-graphic-p)
(menu-bar-mode 1)
(menu-bar-mode -1))))
(add-hook 'after-load-theme-hook
(lambda ()
(let ((bg (frame-parameter nil 'background-mode)))
(set-frame-parameter nil 'ns-appearance bg)
(setcdr (assq 'ns-appearance default-frame-alist) bg)))))

(defun refresh-ns-appearance ()
"Refresh frame parameter ns-appearance."
(let ((bg (frame-parameter nil 'background-mode)))
(set-frame-parameter nil 'ns-appearance bg)
(setcdr (assq 'ns-appearance default-frame-alist) bg)))
(add-hook 'after-load-theme-hook #'refresh-ns-appearance)
(with-eval-after-load'auto-dark
(add-hook 'auto-dark-dark-mode-hook #'refresh-ns-appearance)
(add-hook 'auto-dark-light-mode-hook #'refresh-ns-appearance)))

;; Theme
(if (centaur-compatible-theme-p centaur-theme)
Expand Down

0 comments on commit c3fdf6f

Please sign in to comment.