From e495003a3ff5f9a1b9f518e3bbfced8ca1e77a79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= <commit@rgoncalves.se>
Date: Sat, 4 Dec 2021 22:42:44 +0000
Subject: config.h: Add media keys and script abstraction

---
 config.h | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

(limited to 'config.h')

diff --git a/config.h b/config.h
index 2e8fd0f..1b345e0 100644
--- a/config.h
+++ b/config.h
@@ -1,5 +1,6 @@
 /* See LICENSE file for copyright and license details. */
 
+#include <X11/XF86keysym.h>
 #include "movestack.c"
 
 /* appearance */
@@ -58,12 +59,21 @@ static const Layout layouts[] = {
 /* commands */
 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_white, "-sb", col_white, "-sf", col_black, NULL };
-static const char *termcmd[]  = { "st", NULL };
+static const char *termcmd[]  = { ".bin/ag-term", NULL };
+static const char *audio_increase_cmd[] = { ".bin/ag-audio", "inc", NULL };
+static const char *audio_decrease_cmd[] = { ".bin/ag-audio", "dec", NULL };
+static const char *audio_toggle_microphone_cmd[] = { ".bin/ag-audio", "mic-toggle", NULL };
+static const char *audio_toggle_cmd[] = { ".bin/ag-audio", "toggle", NULL };
+static const char *audio_next_cmd[] = { ".bin/ag-audio", "next", NULL };
+static const char *audio_prev_cmd[] = { ".bin/ag-audio", "prev", NULL };
+static const char *audio_play_cmd[] = { ".bin/ag-audio", "play", NULL };
+static const char *light_increase_cmd[] = { ".bin/ag-light", "inc", NULL };
+static const char *light_decrease_cmd[] = { ".bin/ag-light", "dec", NULL };
+static const char *lock_suspend_cmd[] = { ".bin/ag-lock", "-s", NULL };
+static const char *lock_cmd[] = { ".bin/ag-lock", NULL };
 
 static Key keys[] = {
 	/* modifier                     key        function        argument */
-	{ MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
-	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
 	{ MODKEY,                       XK_b,      togglebar,      {0} },
 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
@@ -88,6 +98,21 @@ static Key keys[] = {
 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
+	/* volume */
+	{ 0,                            XF86XK_AudioRaiseVolume,   spawn, {.v = audio_increase_cmd } },
+	{ 0,                            XF86XK_AudioLowerVolume,   spawn, {.v = audio_decrease_cmd } },
+	{ 0,                            XF86XK_AudioMicMute,       spawn, {.v = audio_toggle_microphone_cmd } },
+	{ 0,                            XF86XK_AudioMute,          spawn, {.v = audio_toggle_cmd } },
+	{ 0,                            XF86XK_AudioNext,          spawn, {.v = audio_next_cmd } },
+	{ 0,                            XF86XK_AudioPrev,          spawn, {.v = audio_prev_cmd } },
+	{ 0,                            XF86XK_AudioPlay,          spawn, {.v = audio_play_cmd } },
+	{ 0,                            XF86XK_MonBrightnessUp,    spawn, {.v = light_increase_cmd } },
+	{ 0,                            XF86XK_MonBrightnessDown,  spawn, {.v = light_decrease_cmd } },
+	/* commands */
+	{ MODKEY|ShiftMask,             XK_F12,    spawn,          {.v = lock_suspend_cmd } },
+	{ MODKEY,                       XK_F12,    spawn,          {.v = lock_cmd } },
+	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
+	{ MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
 	TAGKEYS(                        XK_1,                      0)
 	TAGKEYS(                        XK_2,                      1)
 	TAGKEYS(                        XK_3,                      2)
@@ -107,7 +132,6 @@ static Button buttons[] = {
 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
-	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
-- 
cgit v1.2.3