combo patch
This commit is contained in:
@@ -64,4 +64,5 @@ Most patches can be found on the suckless website: [https://dwm.suckless.org/pat
|
|||||||
* [center](https://dwm.suckless.org/patches/center/) - Add an `iscentered` rule to automatically center clients on the current monitor
|
* [center](https://dwm.suckless.org/patches/center/) - Add an `iscentered` rule to automatically center clients on the current monitor
|
||||||
* [cfacts](https://dwm.suckless.org/patches/cfacts/) - Assign different weights to clients in their respective stack in tiled layout
|
* [cfacts](https://dwm.suckless.org/patches/cfacts/) - Assign different weights to clients in their respective stack in tiled layout
|
||||||
* [cfacts-vanitygaps](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-vanitygaps-6.2.diff) - Vanity gaps patch compatible with cfacts patch
|
* [cfacts-vanitygaps](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-vanitygaps-6.2.diff) - Vanity gaps patch compatible with cfacts patch
|
||||||
|
* [combo](https://dwm.suckless.org/patches/combo/) - Select multiple tags for tag or view by pressing all the right keys as a combo
|
||||||
* [fixborders](https://dwm.suckless.org/patches/alpha/) - Make borders opaque
|
* [fixborders](https://dwm.suckless.org/patches/alpha/) - Make borders opaque
|
||||||
|
14
config.def.h
14
config.def.h
@@ -71,9 +71,9 @@ static const Layout layouts[] = {
|
|||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
{ MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
@@ -115,7 +115,7 @@ static Key keys[] = {
|
|||||||
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
|
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
|
||||||
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
|
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
|
||||||
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, comboview, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_j, aspectresize, {.i = +24} },
|
{ MODKEY|ShiftMask, XK_j, aspectresize, {.i = +24} },
|
||||||
{ MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} },
|
{ MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
@@ -126,8 +126,8 @@ static Key keys[] = {
|
|||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||||
{ MODKEY, XK_Tab, toggleAttachBelow, {0} },
|
{ MODKEY, XK_Tab, toggleAttachBelow, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, comboview, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, combotag, {.ui = ~0 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
@@ -155,9 +155,9 @@ static Button buttons[] = {
|
|||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
{ ClkTagBar, 0, Button1, view, {0} },
|
{ ClkTagBar, 0, Button1, comboview, {0} },
|
||||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
{ ClkTagBar, MODKEY, Button1, combotag, {0} },
|
||||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
43
dwm.c
43
dwm.c
@@ -254,6 +254,11 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
|||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
|
static void keyrelease(XEvent *e);
|
||||||
|
static void combotag(const Arg *arg);
|
||||||
|
static void comboview(const Arg *arg);
|
||||||
|
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static const char broken[] = "broken";
|
static const char broken[] = "broken";
|
||||||
static char stext[256];
|
static char stext[256];
|
||||||
@@ -265,6 +270,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
|
|||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
[ButtonPress] = buttonpress,
|
||||||
|
[ButtonRelease] = keyrelease,
|
||||||
[ClientMessage] = clientmessage,
|
[ClientMessage] = clientmessage,
|
||||||
[ConfigureRequest] = configurerequest,
|
[ConfigureRequest] = configurerequest,
|
||||||
[ConfigureNotify] = configurenotify,
|
[ConfigureNotify] = configurenotify,
|
||||||
@@ -272,6 +278,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
[EnterNotify] = enternotify,
|
[EnterNotify] = enternotify,
|
||||||
[Expose] = expose,
|
[Expose] = expose,
|
||||||
[FocusIn] = focusin,
|
[FocusIn] = focusin,
|
||||||
|
[KeyRelease] = keyrelease,
|
||||||
[KeyPress] = keypress,
|
[KeyPress] = keypress,
|
||||||
[MappingNotify] = mappingnotify,
|
[MappingNotify] = mappingnotify,
|
||||||
[MapRequest] = maprequest,
|
[MapRequest] = maprequest,
|
||||||
@@ -295,6 +302,42 @@ static Window root, wmcheckwin;
|
|||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||||
|
|
||||||
/* function implementations */
|
/* function implementations */
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
applyrules(Client *c)
|
applyrules(Client *c)
|
||||||
{
|
{
|
||||||
|
75
patches/dwm-combo-6.1.diff
Normal file
75
patches/dwm-combo-6.1.diff
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 0362114..40b7a99 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -234,6 +234,11 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
|
+static void keyrelease(XEvent *e);
|
||||||
|
+static void combotag(const Arg *arg);
|
||||||
|
+static void comboview(const Arg *arg);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
static char stext[256];
|
||||||
|
@@ -244,6 +249,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
|
static unsigned int numlockmask = 0;
|
||||||
|
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
|
[ButtonPress] = buttonpress,
|
||||||
|
+ [ButtonRelease] = keyrelease,
|
||||||
|
[ClientMessage] = clientmessage,
|
||||||
|
[ConfigureRequest] = configurerequest,
|
||||||
|
[ConfigureNotify] = configurenotify,
|
||||||
|
@@ -251,6 +257,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
|
[EnterNotify] = enternotify,
|
||||||
|
[Expose] = expose,
|
||||||
|
[FocusIn] = focusin,
|
||||||
|
+ [KeyRelease] = keyrelease,
|
||||||
|
[KeyPress] = keypress,
|
||||||
|
[MappingNotify] = mappingnotify,
|
||||||
|
[MapRequest] = maprequest,
|
||||||
|
@@ -274,6 +281,42 @@ static Window root;
|
||||||
|
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||||
|
|
||||||
|
/* function implementations */
|
||||||
|
+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);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
applyrules(Client *c)
|
||||||
|
{
|
Reference in New Issue
Block a user