wmix: added an option to disable grabbing the volume control keys

There may be some case where user would like to fall back to the original
behaviour, for example if grabbing these keys could get in conflict with
other applications.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS 2014-06-07 21:21:56 +02:00 committed by Carlos R. Mafra
parent d83b160217
commit 67548f3b6a
4 changed files with 22 additions and 2 deletions

View file

@ -41,6 +41,7 @@
" -e <name> exclude channel, can be used many times\n" \
" -f <file> parse this config [~/.wmixrc]\n" \
" -h print this help\n" \
" -k disable grabing volume control keys\n" \
" -m <dev> mixer device [/dev/mixer]\n" \
" -v verbose -> id, long name, name\n" \
@ -64,6 +65,7 @@ void config_init(void)
config.mixer_device = (char *) default_mixer_device;
config.mousewheel = 1;
config.scrolltext = 1;
config.mmkeys = 1;
config.wheel_button_up = 4;
config.wheel_button_down = 5;
config.scrollstep = 0.03;
@ -117,7 +119,7 @@ void parse_cli_options(int argc, char **argv)
config.verbose = false;
error_found = false;
for (;;) {
opt = getopt(argc, argv, ":d:e:f:hm:v");
opt = getopt(argc, argv, ":d:e:f:hkm:v");
if (opt == -1)
break;
@ -158,6 +160,10 @@ void parse_cli_options(int argc, char **argv)
exit(0);
break;
case 'k':
config.mmkeys = false;
break;
case 'm':
if (config.mixer_device != default_mixer_device)
free(config.mixer_device);

View file

@ -34,6 +34,7 @@ extern struct _Config {
unsigned int osd : 1; /* show OSD? */
unsigned int mousewheel : 1; /* mousewheel enabled? */
unsigned int scrolltext : 1; /* scroll channel names? */
unsigned int mmkeys : 1; /* grab multimedia keys for volume control */
unsigned int wheel_button_up; /* up button */
unsigned int wheel_button_down; /* down button */

View file

@ -40,6 +40,12 @@ Use config file instead of
\fB\-h\fR
Display list of command\-line options
.TP
\fB\-k\fR
Disable grabbing the audio volume control keys on keyboard (see
.SM
.B BUGS
below)
.TP
\fB\-m\fR <\fIdevice\fP>
Use specified mixer device instead of
.I /dev/mixer
@ -137,6 +143,11 @@ that a channel has been muted.
The X server allows only one application at a time to place a grab on a key,
so if another application already claimed the volume control keys then \fBwmix\fP
will warn you about it and continue without the functionality.
If on the other hand you encounter problem with applications that do
not work because they could not grab these keys (a typical symptom is
an X Error of type \fIBadAccess\fP with major opcode 33 \fIX_GrabKey\fP),
you can ask \fBwmix\fP to not grab them using the command line option
\fB-k\fP.
.LP
If you modify the configuration file, do not expect \fBwmix\fP to reload
it automatically, this is considered a too costly feature for such a

View file

@ -93,6 +93,8 @@ int main(int argc, char **argv)
dockapp_init(display);
new_window("wmix", 64, 64);
new_osd(DisplayWidth(display, DefaultScreen(display)) - 200, 60);
if (config.mmkeys)
mmkey_install(display);
config_release();