Adding combo patch

pull/32/head
bakkeby 5 years ago
parent e89f262323
commit 706e06be43

@ -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

@ -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 } }

@ -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,

@ -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);
}

@ -0,0 +1,3 @@
static void keyrelease(XEvent *e);
static void combotag(const Arg *arg);
static void comboview(const Arg *arg);

@ -24,6 +24,10 @@
#include "cfacts.c"
#endif
#if COMBO_PATCH
#include "combo.c"
#endif
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.c"
#endif

@ -24,6 +24,10 @@
#include "cfacts.h"
#endif
#if COMBO_PATCH
#include "combo.h"
#endif
#if CYCLELAYOUTS_PATCH
#include "cyclelayouts.h"
#endif

@ -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/
*/

Loading…
Cancel
Save