dwm

dynamic window manager

git clone https://9o.is/git/dwm.git

commit 2e6c9b7727434a65a4a802e553c57dc9fdcff922
parent 783cb1389e50d78789de717d992b457f8976e3a2
Author: Jul <jul@9o.is>
Date:   Wed,  4 Feb 2026 08:25:29 -0500

add volume keybindings

Diffstat:
Mconfig.def.h | 4++++
Mconfig.h | 6++++++
Mdwm.c | 1+
3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -71,6 +71,8 @@ static const Layout layouts[] = { 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 }; +static const char *incvol[] = {"/usr/bin/amixer", "set", "Master", "5+", NULL}; +static const char *decvol[] = {"/usr/bin/amixer", "set", "Master", "5-", NULL}; #include "shift-tools.c" @@ -114,6 +116,8 @@ static const Key keys[] = { SHIFTKEYS( XK_Right, +1) { MODKEY|ShiftMask, XK_q, quit, {0} }, { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = decvol} }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = incvol} }, }; /* button definitions */ diff --git a/config.h b/config.h @@ -80,6 +80,9 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() static const char *dmenu_launch[] = { "dmenu-launch", "-m", dmenumon, NULL }; static const char *dmenu_cmd[] = { "dmenu-cmd", "-m", dmenumon, NULL }; static const char *term_cmd[] = { "dmenu-terminal", NULL }; +static const char *incvol[] = {"dmenu-volume", "increment", "10", NULL}; +static const char *decvol[] = {"dmenu-volume", "decrement", "10", NULL}; +static const char *mutvol[] = {"dmenu-volume", "mute", NULL}; #include "shift-tools.c" @@ -113,6 +116,9 @@ static const Key keys[] = { DIRKEYS( XK_Right, +1) LAYKEYS( XK_Up, -1) LAYKEYS( XK_Down, +1) + { 0, XF86XK_AudioLowerVolume, spawn, {.v = decvol} }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = incvol} }, + { 0, XF86XK_AudioMute, spawn, {.v = mutvol} }, }; /* button definitions */ diff --git a/dwm.c b/dwm.c @@ -36,6 +36,7 @@ #include <X11/Xlib.h> #include <X11/Xproto.h> #include <X11/Xutil.h> +#include <X11/XF86keysym.h> #ifdef XINERAMA #include <X11/extensions/Xinerama.h> #endif /* XINERAMA */