summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--volume.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/volume.cpp b/volume.cpp
index ca2f564..2ece4fc 100644
--- a/volume.cpp
+++ b/volume.cpp
@@ -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");