Enable volume control with volume keys
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#include "exitdwm.c"
|
||||
#include <X11/XF86keysym.h> /* Allow using F# keys for keybinds */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 4; /* border pixel of windows */
|
||||
@@ -58,6 +59,11 @@ 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 } }
|
||||
|
||||
/* volume commands */
|
||||
static const char *upvol[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+", NULL };
|
||||
static const char *downvol[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL };
|
||||
static const char *mutevol[] = { "/usr/bin/wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL };
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
|
||||
@@ -65,6 +71,11 @@ static const char *termcmd[] = { "st", NULL };
|
||||
static const char *slockcmd[] = { "slock", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
/* Volume keys support */
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = mutevol } },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } },
|
||||
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
|
||||
Reference in New Issue
Block a user