Implementing keyboard media controls

This commit is contained in:
Jarkko Toivanen 2024-07-27 19:18:32 +03:00
parent 817c4b2a4e
commit c2f0c17fed

View file

@ -74,6 +74,10 @@ static const char *termcmd[] = { "st", NULL };
static const char *upvol[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", NULL };
static const char *downvol[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", NULL };
static const char *mutevol[] = { "pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
static const char *plstop[] = { "playerctl", "stop", NULL };
static const char *plpause[] = { "playerctl", "play-pause", NULL };
static const char *plnext[] = { "playerctl", "previous", NULL };
static const char *plprev[] = { "playerctl", "next", NULL };
static const Key keys[] = {
/* modifier key function argument */
@ -131,6 +135,14 @@ static const Key keys[] = {
{ WINKEY, XK_F10, spawn, {.v = downvol } },
{ WINKEY, XK_F11, spawn, {.v = upvol } },
{ WINKEY, XK_F9, spawn, {.v = mutevol } },
{ WINKEY, XK_F5, spawn, {.v = plprev } },
{ WINKEY, XK_F6, spawn, {.v = plnext } },
{ WINKEY, XK_F7, spawn, {.v = plpause } },
{ WINKEY, XK_F8, spawn, {.v = plstop } },
{ WINKEY, XF86XK_AudioPrev, spawn, {.v = plprev } },
{ WINKEY, XF86XK_AudioNext, spawn, {.v = plnext } },
{ WINKEY, XF86XK_AudioPause, spawn, {.v = plpause } },
{ WINKEY, XF86XK_AudioStop, spawn, {.v = plstop } },
};
/* button definitions */