dwm brightness n volume

This commit is contained in:
cubernetes 2026-06-11 11:12:37 +02:00
parent bc5da406c8
commit 682c0b5836

View file

@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
@ -60,6 +62,8 @@ 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_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "alacritty", NULL };
static const char *brightness[2][4] = { { "brightnessctl", "set", "5%+", NULL }, { "brightnessctl", "set", "5%-", NULL } };
static const char *volume[3][5] = { { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", NULL}, { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", NULL}, { "pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL} };
static const Key keys[] = {
/* modifier key function argument */
@ -86,6 +90,11 @@ static const Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = brightness[0] } },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = brightness[1] } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volume[0] } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = volume[1] } },
{ 0, XF86XK_AudioMute, spawn, {.v = volume[2] } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)