Add volume controls

This commit is contained in:
Jarkko Toivanen 2024-07-17 19:31:13 +03:00
parent 259bdf48da
commit 9e119a9c04
Signed by: jt
GPG key ID: 9151B109B73ECAD5

View file

@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
@ -70,6 +71,9 @@ 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_black, "-nf", col_amber, "-sb", col_amber, "-sf", col_black, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
static const Key keys[] = {
/* modifier key function argument */
@ -121,6 +125,12 @@ static const Key keys[] = {
{ 0, XK_Print, spawn, SHCMD("scrot -s -F $(xdg-user-dir PICTURES)/scrot/scrot.png -e 'xclip -selection clipboard -t image/png -i $f'") },
{ WINKEY, XK_Print, spawn, SHCMD("scrot -M 0 -F $(xdg-user-dir PICTURES)/scrot/scrot.png -e 'xclip -selection clipboard -t image/png -i $f'") },
{ ALTKEY, XK_Print, spawn, SHCMD("scrot -u -F $(xdg-user-dir PICTURES)/scrot/scrot.png -e 'xclip -selection clipboard -t image/png -i $f'") },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } },
{ 0, XF86XK_AudioMute, spawn, {.v = mutevol } },
{ WINKEY, XK_F10, spawn, {.v = downvol } },
{ WINKEY, XK_F11, spawn, {.v = upvol } },
{ WINKEY, XK_F9, spawn, {.v = mutevol } },
};
/* button definitions */