Add shortcuts Volume

This commit is contained in:
Linux User 2022-08-18 22:25:52 +00:00
parent 5ee385461b
commit da13a67b78
4 changed files with 98 additions and 76 deletions

View File

@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */ /* appearance */
static const unsigned int borderpx = 4; static const unsigned int borderpx = 4;
@ -68,8 +70,14 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", NULL }; static const char *screenshot[] = { "scrsht", NULL };
static const char *screenshotarea[] = { "scrsht", "-s", NULL }; static const char *screenshotarea[] = { "scrsht", "-s", NULL };
static const char *volup[] = { "pactl", "set-sink-volume", "0", "+5%", NULL };
static const char *voldown[] = { "pactl", "set-sink-volume", "0", "-5%", NULL };
static const char *volmute[] = { "pactl", "set-sink-mute", "0", "toggle", NULL };
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
@ -77,6 +85,9 @@ static Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } }, { 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } }, { ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } },
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } }, { SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } }, { SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} }, { SUPERKEY, XK_b, togglebar, {0} },

View File

@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */ /* appearance */
static const unsigned int borderpx = 4; static const unsigned int borderpx = 4;
@ -68,8 +70,14 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", NULL }; static const char *screenshot[] = { "scrsht", NULL };
static const char *screenshotarea[] = { "scrsht", "-s", NULL }; static const char *screenshotarea[] = { "scrsht", "-s", NULL };
static const char *volup[] = { "pactl", "set-sink-volume", "0", "+5%", NULL };
static const char *voldown[] = { "pactl", "set-sink-volume", "0", "-5%", NULL };
static const char *volmute[] = { "pactl", "set-sink-mute", "0", "toggle", NULL };
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
@ -77,6 +85,9 @@ static Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } }, { 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } }, { ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } },
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } }, { SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } }, { SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} }, { SUPERKEY, XK_b, togglebar, {0} },

BIN
dwm

Binary file not shown.

BIN
dwm.o

Binary file not shown.