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. */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 4;
@ -68,50 +70,59 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", 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 *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
/* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } },
{ 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_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */

View File

@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 4;
@ -68,50 +70,59 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", 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 *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
/* modifier key function argument */
{ 0, XK_Print, spawn, {.v = screenshot } },
{ 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_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */

BIN
dwm

Binary file not shown.

BIN
dwm.o

Binary file not shown.