Skip to content

Commit

Permalink
support mac
Browse files Browse the repository at this point in the history
  • Loading branch information
mqcmd196 committed Sep 12, 2024
1 parent d67bcfb commit 6021cfd
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions non-sudoer/emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,29 @@
;; when light mode, use one-light. else use deeper-blue
(let* ((os-color-scheme
(or (getenv "OS_COLOR_SCHEME")
(if (getenv "WSLENV")
;; WSL: check Windows theme
(if (string-match "1"
(shell-command-to-string
"powershell.exe Get-ItemProperty -Path \"HKCU:\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Themes\\\\Personalize\" -Name AppsUseLightTheme | grep AppsUseLightTheme | awk '{ print $3 }' | grep 1"))
"light"
"dark")
;; GNOME: check GTK theme
(if (string-match "dark"
(cond
;; WSL: check Windows theme
((getenv "WSLENV")
(if (string-match "1"
(shell-command-to-string
"gsettings get org.gnome.desktop.interface gtk-theme"))
"dark"
"light")))))
"powershell.exe Get-ItemProperty -Path \"HKCU:\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Themes\\\\Personalize\" -Name AppsUseLightTheme | grep AppsUseLightTheme | awk '{ print $3 }' | grep 1"))
"light"
"dark"))

;; GNOME: check GTK theme
((string-match "dark"
(shell-command-to-string
"gsettings get org.gnome.desktop.interface gtk-theme"))
"dark")

;; MacOS: check system theme
((string-match "Dark"
(shell-command-to-string
"defaults read -g AppleInterfaceStyle 2>/dev/null"))
"dark")

;; Default to light theme if none of the above matched
(t "light")))))
(if (string= os-color-scheme "light")
(load-theme 'one-light t)
;; use obinata-deeper-blue
Expand Down

0 comments on commit 6021cfd

Please sign in to comment.