浏览代码

volume up/down added

mahi97 8 年之前
父节点
当前提交
8f47c96453
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      plugins/osx/osx.plugin.zsh

+ 16 - 0
plugins/osx/osx.plugin.zsh

@@ -327,6 +327,22 @@ function spotify() {
         if [[ "$2" = "show" || "$2" = "" ]]; then
           echo "Current Spotify volume level is $vol.";
           break ;
+        elif [ "$2" = "up" ]; then
+          if [ "$vol" -le 90 ]; then
+            newvol=$(( vol+10 ));
+            echo "Increasing Spotify volume to $newvol.";
+          else
+            newvol=100;
+            echo "Spotify volume level is at max.";
+          fi
+        elif [ "$2" = "down" ]; then
+          if [ "$vol" -ge 10 ]; then
+            newvol=$(( vol-10 ));
+            echo "Reducing Spotify volume to $newvol.";
+          else
+            newvol=0;
+            echo "Spotify volume level is at min.";
+          fi
         elif [ "$2" -ge 0 ]; then
           newvol=$2;
         fi