commit 0f7ed3b750136ee651f0eef207ed63c71304184d
parent 16f07197ae58960533aac23127a085b09944b737
Author: Jake Koroman <jakekoroman@gmail.com>
Date: Mon, 1 Apr 2024 19:28:31 -0400
audio binds
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dwl/config.h b/dwl/config.h
@@ -3,6 +3,11 @@
((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, \
(hex & 0xFF) / 255.0f }
+
+#define AUDIODOWN XKB_KEY_XF86AudioLowerVolume
+#define AUDIOUP XKB_KEY_XF86AudioRaiseVolume
+#define AUDIOMUTE XKB_KEY_XF86AudioMute
+
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
@@ -64,6 +69,10 @@ static const char *bookmarkscmd[] = { "bookmarks", NULL };
static const char *passcmd[] = { "passmenu-otp", NULL };
static const char *sshmenucmd[] = { "sshmenu", NULL };
+static const char *volmutecmd[] = { "wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL };
+static const char *voldowncmd[] = { "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "2%-", NULL };
+static const char *volupcmd[] = { "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "2%+", NULL };
+
static const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
@@ -93,7 +102,7 @@ static const Key keys[] = {
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_M, setlayout, {.v = &layouts[lcenteredmaster]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_f, togglefullscreen, {0} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
@@ -101,6 +110,10 @@ static const Key keys[] = {
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
+ { 0, AUDIODOWN, spawn, {.v = voldowncmd} },
+ { 0, AUDIOUP, spawn, {.v = volupcmd} },
+ { 0, AUDIOMUTE, spawn, {.v = volmutecmd} },
+
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),