diff options
| author | Ryan Brushett <RyanBrushett@users.noreply.github.com> | 2016-12-30 14:29:17 -0330 | 
|---|---|---|
| committer | Marc Cornellà <marc.cornella@live.com> | 2016-12-30 18:59:17 +0100 | 
| commit | ff5629e60b815b3c21ef216d5ba5943932589758 (patch) | |
| tree | 6802fbf08d48b4b75b62764c5d03fe244ae3deed /plugins/osx | |
| parent | 9dab3c6718d627bc3ea5beb79bfbf0a7f74a7648 (diff) | |
| download | zsh-ff5629e60b815b3c21ef216d5ba5943932589758.tar.gz zsh-ff5629e60b815b3c21ef216d5ba5943932589758.tar.bz2 zsh-ff5629e60b815b3c21ef216d5ba5943932589758.zip | |
Improve UX for Spotify quit command in osx plugin (#5726)
* Improve UX for Spotify commands in osx plugin
Spotify command UX is a bit weak for people who live and work almost entirely in shells.
- `spotify quit` should not open Spotify if it is not already running. Should confirm that Spotify is indeed not running.
- `spotify quit` should not blow away the user's shell once Spotify is quit. This can be a disruption to work flow.
This PR looks to add a few little checks which will help improve this experience.
This PR also adds a space to line 477 between `break` and `;;` for consistency. Doesn't seem like a big enough change to put in its own PR.
* Rearranging output as per peer feedback
* osx plugin's spotify: change quitting w/ closing
Closing is more idiomatic English.
Diffstat (limited to 'plugins/osx')
| -rw-r--r-- | plugins/osx/osx.plugin.zsh | 14 | 
1 files changed, 9 insertions, 5 deletions
| diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index d7baa1191..95ef3e1aa 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -323,7 +323,7 @@ function spotify() {    if [ $# = 0 ]; then      showHelp;    else -    if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then +    if [ "$1" != "quit" ] && [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then        osascript -e 'tell application "Spotify" to activate'        sleep 2      fi @@ -413,9 +413,13 @@ function spotify() {          break ;;        "quit"    ) -        cecho "Quitting Spotify."; -        osascript -e 'tell application "Spotify" to quit'; -        exit 1 ;; +        if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then +          cecho "Spotify was not running." +        else +          cecho "Closing Spotify."; +          osascript -e 'tell application "Spotify" to quit'; +        fi +        break ;;        "next"    )          cecho "Going to next track." ; @@ -470,7 +474,7 @@ function spotify() {        "pos"   )          cecho "Adjusting Spotify play position."          osascript -e "tell application \"Spotify\" to set player position to $2"; -        break;; +        break ;;        "status" )          showStatus; | 
