From b76513d7b6461294a5b65a1c83156d2a7a935a7c Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 19:52:23 -0500 Subject: [PATCH 1/8] Change `osascript` calls to use heredocs so they don't extend beyond 100 chars --- neofetch | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index c23cf985..d0eea8be 100755 --- a/neofetch +++ b/neofetch @@ -1603,13 +1603,23 @@ get_song() { "Linux") get_song_dbus "spotify" ;; "Mac OS X") - song="$(osascript -e 'tell application "Spotify" to artist of current track as string & " - " & name of current track as string')" + song="$(osascript < Date: Thu, 1 Feb 2018 21:58:06 -0500 Subject: [PATCH 2/8] Detect iTunes/Spotify successfully when the other is not running --- neofetch | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index d0eea8be..f737c056 100755 --- a/neofetch +++ b/neofetch @@ -1522,7 +1522,7 @@ get_memory() { } get_song() { - player="$(ps -e | grep -m 1 -o -F \ + player="$(ps -e | grep -m 1 -o \ -e "Google Play" \ -e "Spotify" \ -e "amarok" \ @@ -1537,7 +1537,7 @@ get_song() { -e "exaile" \ -e "gnome-music" \ -e "guayadeque" \ - -e "iTunes.app" \ + -e "iTunes$" \ -e "juk" \ -e "lollypop" \ -e "mocp" \ @@ -1604,9 +1604,11 @@ get_song() { "Mac OS X") song="$(osascript < Date: Thu, 1 Feb 2018 22:01:22 -0500 Subject: [PATCH 3/8] Fix `uppercase()` outputting nothing under `bash` < v4 --- neofetch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f737c056..28300962 100755 --- a/neofetch +++ b/neofetch @@ -3255,7 +3255,11 @@ strip_sequences() { } uppercase() { - ((bash_version >= 4)) && printf "%s" "${1^}" + if ((bash_version >= 4)); then + printf "%s" "${1^}" + else + echo $1 + fi } # COLORS From 80d7cef7a01e2db803e3bdfdd43a7e8c8f2fbb0a Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 22:01:35 -0500 Subject: [PATCH 4/8] 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") From 9e4434e5e5163aeb1bc94c15dcd4de223d1c5993 Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 22:26:18 -0500 Subject: [PATCH 5/8] Add missing double-quotes in `uppercase()` fix --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index cd807825..b460019f 100755 --- a/neofetch +++ b/neofetch @@ -3265,7 +3265,7 @@ uppercase() { if ((bash_version >= 4)); then printf "%s" "${1^}" else - echo $1 + echo "$1" fi } From d8addb3e3b16ec20a07cf3aa0ffd9ba556854202 Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 23:28:02 -0500 Subject: [PATCH 6/8] =?UTF-8?q?Change=20`echo`=20=E2=86=92=20`printf`=20fo?= =?UTF-8?q?r=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index b460019f..d8f856e8 100755 --- a/neofetch +++ b/neofetch @@ -3265,7 +3265,7 @@ uppercase() { if ((bash_version >= 4)); then printf "%s" "${1^}" else - echo "$1" + printf "%s" "$1" fi } From eb062afe957ddc081c0d112f536c816ac7384d89 Mon Sep 17 00:00:00 2001 From: Joseph Durel Date: Thu, 1 Feb 2018 23:43:03 -0500 Subject: [PATCH 7/8] Align heredoc AppleScript strings to `osascript` calls --- neofetch | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/neofetch b/neofetch index d8f856e8..c710775d 100755 --- a/neofetch +++ b/neofetch @@ -1611,11 +1611,12 @@ get_song() { "Mac OS X") song="$(osascript < Date: Thu, 1 Feb 2018 23:46:50 -0500 Subject: [PATCH 8/8] =?UTF-8?q?Full=20`if`=20=E2=86=92=20single=20line=20f?= =?UTF-8?q?or=20macOS=20Light=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- neofetch | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/neofetch b/neofetch index c710775d..91bf857b 100755 --- a/neofetch +++ b/neofetch @@ -930,9 +930,7 @@ get_wm_theme() { wm_theme="$(PlistBuddy -c "Print AppleInterfaceStyle" "$global_preferences")" wm_theme_color="$(PlistBuddy -c "Print AppleAquaColorVariant" "$global_preferences")" - if [[ -z "$wm_theme" ]]; then - wm_theme="Light" - fi + [[ -z "$wm_theme" ]] && wm_theme="Light" if [[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)); then wm_theme_color="Blue"