fix: fixed button mapping and added documentation

This commit is contained in:
2025-02-21 13:57:35 +01:00
parent cc72b2eff6
commit 26303b95e9

View File

@@ -3,8 +3,14 @@
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
/* Helper macros for spawning commands */ /* Helper macros for spawning commands */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) \
#define CMD(...) { .v = (const char*[]){ __VA_ARGS__, NULL } } { \
.v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } \
}
#define CMD(...) \
{ \
.v = (const char *[]) { __VA_ARGS__, NULL } \
}
/* appearance */ /* appearance */
#if ROUNDED_CORNERS_PATCH #if ROUNDED_CORNERS_PATCH
@@ -57,7 +63,13 @@ static const int topbar = 1; /* 0 means bottom bar */
/* Display modes of the tab bar: never shown, always shown, shown only in */ /* Display modes of the tab bar: never shown, always shown, shown only in */
/* monocle mode in the presence of several windows. */ /* monocle mode in the presence of several windows. */
/* Modes after showtab_nmodes are disabled. */ /* Modes after showtab_nmodes are disabled. */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always}; enum showtab_modes
{
showtab_never,
showtab_auto,
showtab_nmodes,
showtab_always
};
static const int showtab = showtab_auto; /* Default tab bar show mode */ static const int showtab = showtab_auto; /* Default tab bar show mode */
static const int toptab = False; /* False means bottom tab bar */ static const int toptab = False; /* False means bottom tab bar */
#endif // TAB_PATCH #endif // TAB_PATCH
@@ -900,8 +912,7 @@ static const char *dmenucmd[] = {
#if BAR_DMENUMATCHTOP_PATCH #if BAR_DMENUMATCHTOP_PATCH
topbar ? NULL : "-b", topbar ? NULL : "-b",
#endif // BAR_DMENUMATCHTOP_PATCH #endif // BAR_DMENUMATCHTOP_PATCH
NULL NULL};
};
static const char *termcmd[] = {"kitty", NULL}; static const char *termcmd[] = {"kitty", NULL};
static const char *prtscrcmd[] = {"flameshot", "gui", NULL}; static const char *prtscrcmd[] = {"flameshot", "gui", NULL};
static const char *mutevol[] = {"pactl", "set-sink-mute", "0", "toggle", NULL}; static const char *mutevol[] = {"pactl", "set-sink-mute", "0", "toggle", NULL};
@@ -1393,8 +1404,7 @@ static const Key keys[] = {
TAGKEYS(XK_6, 5) TAGKEYS(XK_6, 5)
TAGKEYS(XK_7, 6) TAGKEYS(XK_7, 6)
TAGKEYS(XK_8, 7) TAGKEYS(XK_8, 7)
TAGKEYS( XK_9, 8) TAGKEYS(XK_9, 8)};
};
#if KEYMODES_PATCH #if KEYMODES_PATCH
static const Key cmdkeys[] = { static const Key cmdkeys[] = {
@@ -1422,11 +1432,22 @@ static const Command commands[] = {
}; };
#endif // KEYMODES_PATCH #endif // KEYMODES_PATCH
// Mouse: Logitech G502 Hero
#define Button6 6 // Buttons 1-5 defined in library already
#define Button7 7 // Button1 // left click
#define Button8 8 // Button2 // middle click
#define Button9 9 // Button3 // right click
// Button4 // scroll wheel up
// Button5 // scroll wheel down
#define Button6 6 // scroll wheel left
#define Button7 7 // scroll wheel right
#define Button8 8 // back button
#define Button9 9 // forward button
#define Button10 10 // undefined
#define Button11 11 // extra thumb button
#define Button12 12 // top middle button
#define Button13 13 // left bottom extra button
#define Button14 14 // left top extra button
/* button definitions */ /* button definitions */
#if STATUSBUTTON_PATCH #if STATUSBUTTON_PATCH
@@ -1436,9 +1457,10 @@ static const Command commands[] = {
#endif // #endif //
static const Button buttons[] = { static const Button buttons[] = {
/* click event mask button function argument */ /* click event mask button function argument */
{ ClkRootWin, 0, Button9, spawn, {.v = upvol } }, {ClkClientWin, 0, Button11, spawn, {.v = mutemic}},
{ ClkRootWin, 0, Button8, spawn, {.v = downvol } }, {ClkClientWin, 0, Button12, spawn, {.v = termcmd}},
{ ClkRootWin, 0, Button6, spawn, {.v = mutevol } }, {ClkClientWin, 0, Button13, spawn, {.v = downvol}},
{ClkClientWin, 0, Button14, spawn, {.v = upvol}},
#if BAR_STATUSBUTTON_PATCH #if BAR_STATUSBUTTON_PATCH
{ClkButton, 0, Button1, spawn, {.v = dmenucmd}}, {ClkButton, 0, Button1, spawn, {.v = dmenucmd}},
#endif // BAR_STATUSBUTTON_PATCH #endif // BAR_STATUSBUTTON_PATCH