Volume Control

- Bind volume control keys to control PuseAudio volume
This commit is contained in:
Sravan Balaji
2020-08-02 12:06:35 -04:00
parent b788a08745
commit 5e3c442a2f

View File

@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
/* includes */
#include <X11/XF86keysym.h>
#include "movestack.c"
/* appearance */
@@ -71,6 +72,9 @@ static const char *deaddcmd[] = { "/bin/bash", deaddscriptpath, NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *sleepcmd[] = { "slock", "systemctl", "suspend", NULL };
static const char *termcmd[] = { "alacritty", NULL };
static const char *upvolcmd[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "+1%", NULL };
static const char *downvolcmd[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "-1%", NULL };
static const char *mutevolcmd[] = { "/usr/bin/pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
static Key keys[] = {
/* modifier key function argument */
@@ -103,6 +107,9 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvolcmd} },
{ 0, XF86XK_AudioMute, spawn, {.v = mutevolcmd} },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvolcmd} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)