From d8198a74f56c632fd51da1efa6e7cb3f2fae4d08 Mon Sep 17 00:00:00 2001 From: celso Date: Mon, 17 Jul 2023 19:22:35 -0300 Subject: [PATCH] applied hardware volume keys patch --- config.def.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config.def.h b/config.def.h index 8ae0651..06defcf 100644 --- a/config.def.h +++ b/config.def.h @@ -58,15 +58,26 @@ static const Layout layouts[] = { /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +#include + /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *termcmd[] = { "st", NULL }; +/* alsa volume control */ +static const char *alsacmd[] = { "st", "-c", "floatalsamxr", "-e", "alsamixer", NULL }; +static const char *upvol[] = { "amixer", "set", "Master", "2+", NULL }; +static const char *downvol[] = { "amixer", "set", "Master", "2-", NULL }; +/* alsa muting/unmuting */ +static const char *mute[] = { "amixer", "-q", "set", "Master", "toggle", NULL }; static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } }, + { 0, XF86XK_AudioMute, spawn, {.v = mute } }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, @@ -117,6 +128,7 @@ static const Button buttons[] = { { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkStatusText, 0, Button1, spawn, {.v = alsacmd } }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },