From 6a41acef8c024515d24f7816b5342d7516c53855 Mon Sep 17 00:00:00 2001 From: Revaz Nakhutsrishvili Date: Tue, 11 Feb 2025 18:27:11 +0400 Subject: Control volume using XF86XK with wpctl --- config.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.h b/config.h index 352f175..4c4f2e3 100644 --- a/config.h +++ b/config.h @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ @@ -60,6 +61,11 @@ 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 }; +/* volume controls [wireplumber] */ +static const char *volumeincrease[] = { "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+", NULL }; +static const char *volumedecrease[] = { "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL }; +static const char *volumemute[] = { "wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL }; + static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, @@ -95,6 +101,9 @@ static const Key keys[] = { TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_q, quit, {0} }, + { 0, XF86XK_AudioMute , spawn, {.v = volumemute } }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = volumedecrease } }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = volumeincrease } }, }; /* button definitions */ -- cgit v1.2.3-70-g09d2