From 1d04de9c1d219b81bd46326457bba122fb6425f7 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 25 Mar 2016 09:54:32 +1100 Subject: [PATCH 1/3] added support for Google Play Music Desktop Player also adds an optional dependancy of `gpmdp-bash` --- README.md | 7 +++++-- neofetch | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c755561..06806670 100644 --- a/README.md +++ b/README.md @@ -84,13 +84,14 @@ your distro's logo or any ascii art of your choice! - Displaying images: `w3m-img` \[2\] \[3\] or `iTerm2` \[4\] - Thumbnail creation: `imagemagick` +- Displaying song information from Google Play Music Desktop Player: `gpmdp` \[5\] ##### Linux / BSD - Wallpaper: `feh`, `nitrogen` or `gsettings` - Current Song: `mpc` or `cmus` - Resolution: `xorg-xdpyinfo` -- Screenshot: `scrot` \[5\] +- Screenshot: `scrot` \[6\] \[1\] See **[#79](https://github.com/dylanaraps/neofetch/issues/79)** about why this is now a required dependency. @@ -103,7 +104,9 @@ terminal emulators that don't support the xterm escape sequences we're using for \[4\] You can enable the `iTerm2` image backend by using the launch flag `--image_backend iterm2` or by
changing the config option `$image_backend` to `iterm2`. -\[5\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot
+\[5\] This currently isn't in any repositories, see [`gpmdp-bash`](https://github.com/iandrewt/gpmdp-bash) for install instructions + +\[6\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot
program's cmd and neofetch will use it instead of scrot. diff --git a/neofetch b/neofetch index 9cf0f049..981bfa7c 100755 --- a/neofetch +++ b/neofetch @@ -1228,6 +1228,10 @@ getsong () { ;; esac + elif ([ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /Google Play Music Desktop Player/')" ] && [ -n "$(which gpmdp)" ]); then + song="$(gpmdp artist) - $(gpmdp title)" + state="$(gpmdp status)" + elif [ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /iTunes/')" ]; then song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " name of current track as string')" state="$(osascript -e 'tell application "iTunes" to player state as string')" From 808821e2cd7aee1e401e4a4f55348a55198ad2c6 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 25 Mar 2016 13:27:55 +1100 Subject: [PATCH 2/3] fixed gpmdp install instructions --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 06806670..0882f417 100644 --- a/README.md +++ b/README.md @@ -84,14 +84,14 @@ your distro's logo or any ascii art of your choice! - Displaying images: `w3m-img` \[2\] \[3\] or `iTerm2` \[4\] - Thumbnail creation: `imagemagick` -- Displaying song information from Google Play Music Desktop Player: `gpmdp` \[5\] +- Displaying song information from Google Play Music Desktop Player: [`gpmdp`](https://github.com/iAndrewT/gpmdp-bash) ##### Linux / BSD - Wallpaper: `feh`, `nitrogen` or `gsettings` - Current Song: `mpc` or `cmus` - Resolution: `xorg-xdpyinfo` -- Screenshot: `scrot` \[6\] +- Screenshot: `scrot` \[5\] \[1\] See **[#79](https://github.com/dylanaraps/neofetch/issues/79)** about why this is now a required dependency. @@ -104,9 +104,7 @@ terminal emulators that don't support the xterm escape sequences we're using for \[4\] You can enable the `iTerm2` image backend by using the launch flag `--image_backend iterm2` or by
changing the config option `$image_backend` to `iterm2`. -\[5\] This currently isn't in any repositories, see [`gpmdp-bash`](https://github.com/iandrewt/gpmdp-bash) for install instructions - -\[6\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot
+\[5\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot
program's cmd and neofetch will use it instead of scrot. From 9537be0e9459c859b35ce9a6d6ce41d198ff68aa Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 25 Mar 2016 13:44:15 +1100 Subject: [PATCH 3/3] changed with new gpmdp function --- neofetch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 981bfa7c..836b290d 100755 --- a/neofetch +++ b/neofetch @@ -1228,9 +1228,9 @@ getsong () { ;; esac - elif ([ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /Google Play Music Desktop Player/')" ] && [ -n "$(which gpmdp)" ]); then - song="$(gpmdp artist) - $(gpmdp title)" - state="$(gpmdp status)" + elif [ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /Google Play Music Desktop Player/')" ] && type -p gpmdp >/dev/null 2>&1; then + song="$(gpmdp current)" + state="$(gpmdp status)" elif [ -n "$(ps aux | awk '!(/awk/ || /Helper/) && /iTunes/')" ]; then song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " name of current track as string')"