96d57dc33ec7ce473a7ce06d7c0166eabd14e1c8

Author
mahi97 <mohammadmahdi76@gmail.com>
Committer
mahi97 <mohammadmahdi76@gmail.com>
Date

Message

change pause to play/pause

Diff

 1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
 2index 19acd3dd5484e858ea47bec7ac3519e088210929..058576f0be13c0d318bc828e766d3cd35eb88d94 100644
 3--- a/plugins/osx/osx.plugin.zsh
 4+++ b/plugins/osx/osx.plugin.zsh
 5@@ -335,8 +335,14 @@ function spotify() {
 6         break ;;
 7 
 8       "pause"    )
 9-        cecho "Pausing Spotify.";
10-        osascript -e 'tell application "Spotify" to pause';
11+        state=$(osascript -e 'tell application "Spotify" to player state as string');
12+        if [ "$state" = "playing" ]; then
13+          cecho "Pausing Spotify.";
14+        else
15+          cecho "Playing Spotify.";
16+        fi
17+
18+        osascript -e 'tell application "Spotify" to playpause';
19         break ;;
20 
21       "quit"    )