Browse Source

audio control with hardware media keys

dwm6.4
Ivan Polyakov 2 years ago
parent
commit
95f340bef5
  1. 25
      config.def.h

25
config.def.h

@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */ /* appearance */
#if ROUNDED_CORNERS_PATCH #if ROUNDED_CORNERS_PATCH
static const unsigned int borderpx = 0; /* border pixel of windows */ static const unsigned int borderpx = 0; /* border pixel of windows */
@ -850,10 +852,31 @@ static Key on_empty_keys[] = {
}; };
#endif // ON_EMPTY_KEYS_PATCH #endif // ON_EMPTY_KEYS_PATCH
/* up volume */
static const char *upvolcmd[] =
{ "/usr/bin/amixer", "set", "Master", "5%+", NULL };
/* down volume */
static const char *downvolcmd[] =
{ "/usr/bin/amixer", "set", "Master", "5%-", NULL };
/* toggle volume */
static const char *togglevolcmd[] =
{ "/usr/bin/amixer", "set", "Master", "toggle", NULL };
/* toggle microphone */
static const char *togglemiccmd[] =
{ "/usr/bin/amixer", "set", "Capture", "toggle", NULL };
static Key keys[] = { static Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ 0, XF86XK_AudioRaiseVolume, spawn, { .v = upvolcmd } },
{ 0, XF86XK_AudioLowerVolume, spawn, { .v = downvolcmd } },
{ 0, XF86XK_AudioMute, spawn, { .v = togglevolcmd } },
{ 0, XF86XK_AudioMicMute, spawn, { .v = togglemiccmd } },
#if KEYMODES_PATCH #if KEYMODES_PATCH
{ MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} }, { MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE } },
#endif // KEYMODES_PATCH #endif // KEYMODES_PATCH
{ MODKEY, XK_p, spawn, {.v = roficmd } }, { MODKEY, XK_p, spawn, {.v = roficmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },

Loading…
Cancel
Save