summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-18 10:53:07 +0200
committerbakkeby <[email protected]>2020-09-18 10:53:07 +0200
commit00320fb842703d6ee219aa2ed1f71f4d0247ed93 (patch)
treee233b8c900a71713ef55705a0848ba0bcefaa444
parent8aa21b03114a62f4113d0b9410649ca13692886e (diff)
downloaddwm-flexipatch-00320fb842703d6ee219aa2ed1f71f4d0247ed93.tar.gz
dwm-flexipatch-00320fb842703d6ee219aa2ed1f71f4d0247ed93.zip
Adding nomodbuttons patch
-rw-r--r--README.md6
-rw-r--r--config.def.h8
-rw-r--r--dwm.c6
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/nomodbuttons.c7
-rw-r--r--patch/nomodbuttons.h1
-rw-r--r--patches.def.h14
8 files changed, 46 insertions, 2 deletions
diff --git a/README.md b/README.md
index 1866158..728c820 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
+2020-09-18 - Added the nomodbuttons patch allowing for toggleable mouse button bindings that have no modifiers
+
2020-09-10 - Added the anybar patch (with experimental support for dwm bar(s) + anybar)
2020-09-09 - Added the bar border patch
@@ -408,6 +410,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- enable modifying dmenu in config.def.h which resulted previously in a compilation error because two lines of code hardcode dmenu into dwm
- allows complete removal of dmenu, should you want to do that
+ - nomodbuttons
+ - allows for toggleable client button bindings that have no modifiers
+ - this can, for example, allow you to move or resize using the mouse alone without holding down a modifier key, which can be practical if you have extra buttons on your mouse
+
- [no_transparent_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- when terminals have transparency then their borders also become transparent
- this patch ensures that borders have no transparency
diff --git a/config.def.h b/config.def.h
index 1e67089..aa2950b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -11,6 +11,9 @@ static const unsigned int snap = 32; /* snap pixel */
#if SWALLOW_PATCH
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
#endif // SWALLOW_PATCH
+#if NO_MOD_BUTTONS_PATCH
+static int nomodbuttons = 1; /* allow client mouse button bindings that have no modifier */
+#endif // NO_MOD_BUTTONS_PATCH
#if VANITYGAPS_PATCH
static const unsigned int gappih = 20; /* horiz inner gap between windows */
static const unsigned int gappiv = 10; /* vert inner gap between windows */
@@ -882,7 +885,7 @@ static Key keys[] = {
{ MODKEY|Mod5Mask, XK_Tab, rotatelayoutaxis, {.i = -2 } }, /* flextile, 2 = master axis */
{ MODKEY|Mod5Mask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = -3 } }, /* flextile, 3 = stack axis */
{ MODKEY|Mod5Mask|Mod1Mask, XK_Tab, rotatelayoutaxis, {.i = -4 } }, /* flextile, 4 = secondary stack axis */
- { MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */
+ { MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */
#endif // FLEXTILE_DELUXE_LAYOUT
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
@@ -893,6 +896,9 @@ static Key keys[] = {
{ MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, {0} },
{ MODKEY|ControlMask, XK_m, togglemax, {0} },
#endif // MAXIMIZE_PATCH
+ #if NO_MOD_BUTTONS_PATCH
+ { MODKEY|ShiftMask, XK_Escape, togglenomodbuttons, {0} },
+ #endif // NO_MOD_BUTTONS_PATCH
#if SCRATCHPADS_PATCH
{ MODKEY, XK_grave, togglescratch, {.ui = 0 } },
{ MODKEY|ControlMask, XK_grave, togglescratch, {.ui = 1 } },
diff --git a/dwm.c b/dwm.c
index 55d825f..e667a16 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1992,7 +1992,11 @@ grabbuttons(Client *c, int focused)
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
for (i = 0; i < LENGTH(buttons); i++)
- if (buttons[i].click == ClkClientWin)
+ if (buttons[i].click == ClkClientWin
+ #if NO_MOD_BUTTONS_PATCH
+ && (nomodbuttons || buttons[i].mask != 0)
+ #endif // NO_MOD_BUTTONS_PATCH
+ )
for (j = 0; j < LENGTH(modifiers); j++)
XGrabButton(dpy, buttons[i].button,
buttons[i].mask | modifiers[j],
diff --git a/patch/include.c b/patch/include.c
index 50af31a..69092aa 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -174,6 +174,9 @@
#if MOVESTACK_PATCH
#include "movestack.c"
#endif
+#if NO_MOD_BUTTONS_PATCH
+#include "nomodbuttons.c"
+#endif
#if PERTAG_PATCH
#include "pertag.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 63a1387..e7ba3bb 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -170,6 +170,9 @@
#if MOVESTACK_PATCH
#include "movestack.h"
#endif
+#if NO_MOD_BUTTONS_PATCH
+#include "nomodbuttons.h"
+#endif
#if PERTAG_PATCH
#include "pertag.h"
#endif
diff --git a/patch/nomodbuttons.c b/patch/nomodbuttons.c
new file mode 100644
index 0000000..c4e082e
--- /dev/null
+++ b/patch/nomodbuttons.c
@@ -0,0 +1,7 @@
+void
+togglenomodbuttons(const Arg *arg)
+{
+ nomodbuttons = !nomodbuttons;
+ if (selmon->sel)
+ grabbuttons(selmon->sel, 1);
+} \ No newline at end of file
diff --git a/patch/nomodbuttons.h b/patch/nomodbuttons.h
new file mode 100644
index 0000000..4e6c572
--- /dev/null
+++ b/patch/nomodbuttons.h
@@ -0,0 +1 @@
+static void togglenomodbuttons(const Arg *arg); \ No newline at end of file
diff --git a/patches.def.h b/patches.def.h
index e387dc0..f1494e3 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -646,6 +646,20 @@
*/
#define NODMENU_PATCH 0
+/* This patch allows for toggleable client button bindings that have no modifiers.
+ * This can, for example, allow you to move or resize using the mouse alone without holding
+ * down a modifier key. This can be practical if you have extra buttons on your mouse.
+ * While you can use button bindings with no modifiers without this patch in a bare dwm,
+ * those buttons are then unavailable for use within the application itself so being able to
+ * toggle these on and off can be necessary in certain situations (e.g. being able to use
+ * back and forward buttons in a browser).
+
+ * Example bindings:
+ * { ClkClientWin, 0, Button8, movemouse, {0} },
+ * { ClkClientWin, 0, Button9, resizemouse, {0} },
+ */
+#define NO_MOD_BUTTONS_PATCH 0
+
/* When terminals have transparency then their borders also become transparent.
* This patch ensures that borders have no transparency. Note that this patch is
* only relevant if you are not using the alpha patch.