summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-09-11 23:35:43 +0200
committerbakkeby <[email protected]>2019-09-11 23:35:43 +0200
commit706e06be438ec9e20e1ebcfcfbb0ff00bc2d2cc1 (patch)
tree13958df791af844d7c02702c08fdf3dd9d4076d4
parente89f262323c658478c92e4bea041e328c5126248 (diff)
downloaddwm-flexipatch-706e06be438ec9e20e1ebcfcfbb0ff00bc2d2cc1.tar.gz
dwm-flexipatch-706e06be438ec9e20e1ebcfcfbb0ff00bc2d2cc1.zip
Adding combo patch
-rw-r--r--README.md5
-rw-r--r--config.def.h8
-rw-r--r--dwm.c6
-rw-r--r--patch/combo.c35
-rw-r--r--patch/combo.h3
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patches.h7
8 files changed, 71 insertions, 1 deletions
diff --git a/README.md b/README.md
index 6719de2..47106aa 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
-2019-09-11 - Added monitor rules patch.
+2019-09-11 - Added monitor rules and combo patches
2019-09-10 - Minor tweaks to awesomebar patch (incl. alpha and systray compatibility). Added floatbordercolor patch.
@@ -59,6 +59,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [cfacts](https://dwm.suckless.org/patches/cfacts/)
- the cfacts patch provides the ability to assign different weights to clients in their respective stack in tiled layout
+ - [combo](https://dwm.suckless.org/patches/combo/)
+ - allows you to select multiple tags by pressing all the right keys as a combo, e.g. hold MOD and press and hold 1 and 3 together to view those two tags
+
- [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
- lets you cycle through all your layouts
diff --git a/config.def.h b/config.def.h
index da9bfac..31ffa1a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -189,11 +189,19 @@ static const Layout layouts[] = {
/* key definitions */
#define MODKEY Mod1Mask
+#if COMBO_PATCH
+#define TAGKEYS(KEY,TAG) \
+ { MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
+ { MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
+#else
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
+#endif // COMBO_PATCH
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
diff --git a/dwm.c b/dwm.c
index bb92a5d..d32a077 100644
--- a/dwm.c
+++ b/dwm.c
@@ -326,6 +326,9 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
+ #if COMBO_PATCH
+ [ButtonRelease] = keyrelease,
+ #endif // COMBO_PATCH
[ClientMessage] = clientmessage,
[ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify,
@@ -334,6 +337,9 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
+ #if COMBO_PATCH
+ [KeyRelease] = keyrelease,
+ #endif // COMBO_PATCH
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
[MotionNotify] = motionnotify,
diff --git a/patch/combo.c b/patch/combo.c
new file mode 100644
index 0000000..d34142a
--- /dev/null
+++ b/patch/combo.c
@@ -0,0 +1,35 @@
+static int combo = 0;
+
+void
+keyrelease(XEvent *e) {
+ combo = 0;
+}
+
+void
+combotag(const Arg *arg) {
+ if(selmon->sel && arg->ui & TAGMASK) {
+ if (combo) {
+ selmon->sel->tags |= arg->ui & TAGMASK;
+ } else {
+ combo = 1;
+ selmon->sel->tags = arg->ui & TAGMASK;
+ }
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+comboview(const Arg *arg) {
+ unsigned newtags = arg->ui & TAGMASK;
+ if (combo) {
+ selmon->tagset[selmon->seltags] |= newtags;
+ } else {
+ selmon->seltags ^= 1; /*toggle tagset*/
+ combo = 1;
+ if (newtags)
+ selmon->tagset[selmon->seltags] = newtags;
+ }
+ focus(NULL);
+ arrange(selmon);
+} \ No newline at end of file
diff --git a/patch/combo.h b/patch/combo.h
new file mode 100644
index 0000000..d6d141e
--- /dev/null
+++ b/patch/combo.h
@@ -0,0 +1,3 @@
+static void keyrelease(XEvent *e);
+static void combotag(const Arg *arg);
+static void comboview(const Arg *arg); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 43a636b..1ddc897 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -24,6 +24,10 @@
#include "cfacts.c"
#endif
+#if COMBO_PATCH
+#include "combo.c"
+#endif
+
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 49d3a1c..3e3027c 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -24,6 +24,10 @@
#include "cfacts.h"
#endif
+#if COMBO_PATCH
+#include "combo.h"
+#endif
+
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.h"
#endif
diff --git a/patches.h b/patches.h
index f675c1d..05e6b4d 100644
--- a/patches.h
+++ b/patches.h
@@ -73,6 +73,13 @@
*/
#define CFACTS_PATCH 0
+/* This patch tweaks the tagging interface so that you can select multiple tags for tag
+ * or view by pressing all the right keys as a combo. For example to view tags 1 and 3,
+ * hold MOD and then press and hold 1 and 3 together.
+ * https://dwm.suckless.org/patches/combo/
+ */
+#define COMBO_PATCH 0
+
/* The cyclelayouts patch lets you cycle through all your layouts.
* https://dwm.suckless.org/patches/cyclelayouts/
*/