From 80d7cef7a01e2db803e3bdfdd43a7e8c8f2fbb0a Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 22:01:35 -0500 Subject: [PATCH] Add macOS Light/Dark theme detection --- neofetch | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index 28300962..cd807825 100755 --- a/neofetch +++ b/neofetch @@ -926,14 +926,21 @@ get_wm_theme() { ;; "Quartz Compositor") - wm_theme="$(PlistBuddy -c "Print AppleAquaColorVariant" \ - "${HOME}/Library/Preferences/.GlobalPreferences.plist")" + global_preferences="${HOME}/Library/Preferences/.GlobalPreferences.plist" + wm_theme="$(PlistBuddy -c "Print AppleInterfaceStyle" "$global_preferences")" + wm_theme_color="$(PlistBuddy -c "Print AppleAquaColorVariant" "$global_preferences")" - if [[ -z "$wm_theme" ]] || ((wm_theme == 1)); then - wm_theme="Blue" - else - wm_theme="Graphite" + if [[ -z "$wm_theme" ]]; then + wm_theme="Light" fi + + if [[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)); then + wm_theme_color="Blue" + else + wm_theme_color="Graphite" + fi + + wm_theme="$wm_theme_color ($wm_theme)" ;; *"Explorer")