summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2023-02-10 13:34:17 +0100
committerJaroslav Kysela <perex@perex.cz>2023-02-10 13:36:23 +0100
commitdad2161d3cc268f1e75b3ff34905a8affc67b521 (patch)
treecd3d2dacb813370442913c7769036678b6de4fef
parentcf25cf67675235cc35529c717ed89f397aa3f171 (diff)
downloadalsa-utils-dad2161d3cc268f1e75b3ff34905a8affc67b521.tar.gz
alsamixer: add -B,--black-background option
Fixes: https://github.com/alsa-project/alsa-utils/issues/176 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--alsamixer/alsamixer.14
-rw-r--r--alsamixer/cli.c14
2 files changed, 16 insertions, 2 deletions
diff --git a/alsamixer/alsamixer.1 b/alsamixer/alsamixer.1
index be1e24e..d7340a2 100644
--- a/alsamixer/alsamixer.1
+++ b/alsamixer/alsamixer.1
@@ -29,6 +29,10 @@ Select the mixer device to control.
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.
diff --git a/alsamixer/cli.c b/alsamixer/cli.c
index f153f28..a39a4f5 100644
--- a/alsamixer/cli.c
+++ b/alsamixer/cli.c
@@ -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();