diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-02-23 23:50:29 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-02-23 23:50:29 +0100 |
commit | a9f9c2d796123e4097c015d6f276d35056ac7920 (patch) | |
tree | f0fc59cd434c0826b044da432ff1a4436cfac947 | |
parent | 01a79a63ce85a364401a8afc1c42be0120ed9ced (diff) |
-rw-r--r-- | volume.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -11,6 +11,7 @@ int printusage(int,const char *const *argv,const char *message=NULL){ if(message)cout<<message<<endl; cout<<"Usage: "<<argv[0]<<" [volume]\n" "If [volume] is given, changes volume to that value. (Integer in [0,100].)\n" + "If [volume] is given and equal to 'm', toggles mute.\n" "Otherwise, it shows a graphical slider, adjustable with the arrow keys or h/j/k/l;\n" "'m' toggles whether sound is muted; a number directly sets the volume.\n" "Enter or 'q' exits graphical mode.\n" @@ -169,6 +170,10 @@ int main(int argc,char **argv){ if(argc>2)return printusage(argc,argv); if(argc==2){ if(argv[1][0]=='\0')return printusage(argc,argv,"Invalid volume format"); + if(strcmp(argv[1],"m")==0){ + setmuted(!getmuted()); + return 0; + } char *endp; const int vol=strtol(argv[1],&endp,10); if(*endp!='\0')return printusage(argc,argv,"Invalid volume format"); |