Browse Source

change pause to play/pause

mahi97 8 years ago
parent
commit
96d57dc33e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      plugins/osx/osx.plugin.zsh

+ 8 - 2
plugins/osx/osx.plugin.zsh

@@ -335,8 +335,14 @@ function spotify() {
         break ;;
         break ;;
 
 
       "pause"    )
       "pause"    )
-        cecho "Pausing Spotify.";
-        osascript -e 'tell application "Spotify" to pause';
+        state=$(osascript -e 'tell application "Spotify" to player state as string');
+        if [ "$state" = "playing" ]; then
+          cecho "Pausing Spotify.";
+        else
+          cecho "Playing Spotify.";
+        fi
+
+        osascript -e 'tell application "Spotify" to playpause';
         break ;;
         break ;;
 
 
       "quit"    ) 
       "quit"    )