summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-02-23 23:50:29 +0100
committertomsmeding <tom.smeding@gmail.com>2017-02-23 23:50:29 +0100
commita9f9c2d796123e4097c015d6f276d35056ac7920 (patch)
treef0fc59cd434c0826b044da432ff1a4436cfac947
parent01a79a63ce85a364401a8afc1c42be0120ed9ced (diff)
Add command-line mute switchHEADmaster
-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");