diff --git a/config.def.h b/config.def.h index 9494762a..af234619 100644 --- a/config.def.h +++ b/config.def.h @@ -475,13 +475,16 @@ static Button buttons[] = { { ClkClientWin, MODKEY|Mod1Mask, Button3, forceresizemouse, {0} }, { ClkClientWin, MODKEY|ShiftMask, Button3, resizeaspectmouse, {0} }, { ClkTagBar, 0, Button1, dragtag, {0} }, + { ClkTagBar, ControlMask, Button1, dragtag, {0} }, + { ClkTagBar, ShiftMask, Button1, dragtag, {0} }, + { ClkTagBar, ShiftMask|ControlMask, Button1, dragtag, {0} }, + { ClkTagBar, Mod1Mask, Button1, dragtag, {0} }, { ClkTagBar, 0, Button5, viewtoright, {0} }, { ClkTagBar, MODKEY, Button4, shiftview, {.i = -1 } }, { ClkTagBar, MODKEY, Button5, shiftview, {.i = +1 } }, { ClkTagBar, 0, Button4, viewtoleft, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, Mod1Mask, Button1, followtag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkShutDown, 0, Button1, spawn, {.v = instantshutdowncmd } }, { ClkShutDown, 0, Button3, spawn, {.v = slockcmd } }, diff --git a/instantwm.c b/instantwm.c index fa2eb11a..2f265fe8 100644 --- a/instantwm.c +++ b/instantwm.c @@ -3352,7 +3352,20 @@ dragtag(const Arg *arg) if (!tagwidth) tagwidth = gettagwidth(); if ((arg->ui & TAGMASK) != selmon->tagset[selmon->seltags]) { - view(arg); + unsigned int state; + int x; + Window dummy; + XQueryPointer(dpy, root, &dummy, &dummy, &x, &x, &x, &x, &state); + if ((state & ShiftMask) && (state & ControlMask)) + toggletag(arg); + else if (state & ShiftMask) + tag(arg); + else if (state & ControlMask) + toggleview(arg); + else if (state & Mod1Mask) + followtag(arg); + else + view(arg); return; } @@ -3396,10 +3409,19 @@ dragtag(const Arg *arg) if (!leftbar) { if (ev.xmotion.x_root < selmon->mx + tagwidth) { - if (ev.xmotion.state & ShiftMask) { + if ((ev.xmotion.state & ShiftMask) && (ev.xmotion.state & ControlMask)) { + if (tagprefix) { + tagall(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); + tagprefix = 1; + } else + tagall(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); + view(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); + } else if (ev.xmotion.state & ShiftMask) { followtag(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); } else if (ev.xmotion.state & ControlMask) { tagall(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); + } else if (ev.xmotion.state & Mod1Mask) { + swaptags(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); } else { tag(&((Arg) { .ui = 1 << getxtag(ev.xmotion.x_root) })); }