]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsamixer: add -B,--black-background option
authorJaroslav Kysela <perex@perex.cz>
Fri, 10 Feb 2023 12:34:17 +0000 (13:34 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 10 Feb 2023 12:36:23 +0000 (13:36 +0100)
Fixes: https://github.com/alsa-project/alsa-utils/issues/176
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsamixer/alsamixer.1
alsamixer/cli.c

index be1e24e3f09cc53f0a46ee3c1960d185ef302b25..d7340a2081af2cee8577864db0a9d1d8309c5812 100644 (file)
@@ -28,6 +28,10 @@ Select the mixer device to control.
 \fI\-V, \-\-view\fP <mode>
 Select the starting view mode, either \fIplayback\fP, \fIcapture\fP or \fIall\fP.
 
+.TP
+\fI\-B, \-\-black-background\fP
+Use the black background color.
+
 .TP
 \fI\-g, \-\-no\-color\fP
 Toggle the using of colors.
index f153f280cd9fec5c31d94192c249fb0d14929074..a39a4f51e9bc389030c5fcca74266898dc4f9178 100644 (file)
@@ -28,7 +28,9 @@
 #include "mixer_widget.h"
 #include "mainloop.h"
 #include "configparser.h"
+#include "colors.h"
 
+static int black_background = 0;
 static int use_color = 1;
 static int use_mouse = 1;
 static const char* config_file = CONFIG_DEFAULT;
@@ -49,7 +51,8 @@ static void show_help(void)
               "  -M, --no-mouse          disable mouse\n"
               "  -f, --config=FILE       configuration file\n"
               "  -F, --no-config         do not load configuration file\n"
-              "  -V, --view=MODE         starting view mode: playback/capture/all"));
+              "  -V, --view=MODE         starting view mode: playback/capture/all\n"
+              "  -B, --black-background  use black background color"));
        puts(_("Debugging options:\n"
               "  -g, --no-color          toggle using of colors\n"
               "  -a, --abstraction=NAME  mixer abstraction level: none/basic"));
@@ -57,7 +60,7 @@ static void show_help(void)
 
 static void parse_options(int argc, char *argv[])
 {
-       static const char short_options[] = "hc:D:f:FmMV:gsa:";
+       static const char short_options[] = "hc:f:FD:mMV:Bga:";
        static const struct option long_options[] = {
                { .name = "help", .val = 'h' },
                { .name = "card", .has_arg = 1, .val = 'c' },
@@ -67,6 +70,7 @@ static void parse_options(int argc, char *argv[])
                { .name = "mouse", .val = 'm' },
                { .name = "no-mouse", .val = 'M' },
                { .name = "view", .has_arg = 1, .val = 'V' },
+               { .name = "black-background", .val = 'B' },
                { .name = "no-color", .val = 'g' },
                { .name = "abstraction", .has_arg = 1, .val = 'a' },
                { 0 }
@@ -118,6 +122,9 @@ static void parse_options(int argc, char *argv[])
                        else
                                view_mode = VIEW_MODE_ALL;
                        break;
+               case 'B':
+                       black_background = 1;
+                       break;
                case 'g':
                        use_color = !use_color;
                        break;
@@ -161,6 +168,9 @@ int main(int argc, char *argv[])
        else if (config_file)
                parse_config_file(config_file);
 
+       if (black_background)
+               reinit_colors(COLOR_BLACK);
+
        create_mixer_widget();
 
        mainloop();