mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Adding shifttagclients patch ref. #270
This commit is contained in:
parent
a15a259926
commit
279c571986
10
config.def.h
10
config.def.h
@ -983,6 +983,10 @@ static Key keys[] = {
|
||||
{ MODKEY|ShiftMask, XK_Left, shifttag, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagtoleft
|
||||
{ MODKEY|ShiftMask, XK_Right, shifttag, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagtoright
|
||||
#endif // SHIFTTAG_PATCH
|
||||
#if SHIFTTAGCLIENTS_PATCH
|
||||
{ MODKEY|ShiftMask|ControlMask, XK_Left, shifttagclients, { .i = -1 } },
|
||||
{ MODKEY|ShiftMask|ControlMask, XK_Right, shifttagclients, { .i = +1 } },
|
||||
#endif // SHIFTTAGCLIENTS_PATCH
|
||||
#if SHIFTVIEW_PATCH
|
||||
{ MODKEY|ShiftMask, XK_Tab, shiftview, { .i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_backslash, shiftview, { .i = +1 } },
|
||||
@ -1428,6 +1432,9 @@ static Signal signals[] = {
|
||||
#if SHIFTTAG_PATCH
|
||||
{ "shifttag", shifttag },
|
||||
#endif // SHIFTTAG_PATCH
|
||||
#if SHIFTTAGCLIENTS_PATCH
|
||||
{ "shifttagclients", shifttagclients },
|
||||
#endif // SHIFTTAGCLIENTS_PATCH
|
||||
#if SHIFTVIEW_PATCH
|
||||
{ "shiftview", shiftview },
|
||||
#endif // SHIFTVIEW_PATCH
|
||||
@ -1619,6 +1626,9 @@ static IPCCommand ipccommands[] = {
|
||||
#if SHIFTTAG_PATCH
|
||||
IPCCOMMAND( shifttag, 1, {ARG_TYPE_SINT} ),
|
||||
#endif // SHIFTVIEW_PATCH
|
||||
#if SHIFTTAGCLIENTS_PATCH
|
||||
IPCCOMMAND( shifttagclients, 1, {ARG_TYPE_SINT} ),
|
||||
#endif // SHIFTVIEWCLIENTS_PATCH
|
||||
#if SHIFTVIEW_PATCH
|
||||
IPCCOMMAND( shiftview, 1, {ARG_TYPE_SINT} ),
|
||||
#endif // SHIFTVIEW_PATCH
|
||||
|
@ -235,6 +235,9 @@
|
||||
#if SHIFTTAG_PATCH
|
||||
#include "shifttag.c"
|
||||
#endif
|
||||
#if SHIFTTAGCLIENTS_PATCH
|
||||
#include "shifttagclients.c"
|
||||
#endif
|
||||
#if SHIFTVIEW_PATCH
|
||||
#include "shiftview.c"
|
||||
#endif
|
||||
|
@ -237,6 +237,9 @@
|
||||
#if SHIFTTAG_PATCH
|
||||
#include "shifttag.h"
|
||||
#endif
|
||||
#if SHIFTTAGCLIENTS_PATCH
|
||||
#include "shifttagclients.h"
|
||||
#endif
|
||||
#if SHIFTVIEW_PATCH
|
||||
#include "shiftview.h"
|
||||
#endif
|
||||
|
49
patch/shifttagclients.c
Normal file
49
patch/shifttagclients.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Sends a window to the next/prev tag that has a client, else it moves it to the next/prev one. */
|
||||
void
|
||||
shifttagclients(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
Client *c;
|
||||
unsigned int tagmask = 0;
|
||||
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next)
|
||||
#endif // TAGSYNC_PATCH
|
||||
for (c = selmon->clients; c; c = c->next) {
|
||||
if (c == selmon->sel)
|
||||
continue;
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
if (!(c->tags & SPTAGMASK))
|
||||
tagmask = tagmask | c->tags;
|
||||
#elif SCRATCHPAD_ALT_1_PATCH
|
||||
if (!(c->tags & SCRATCHPAD_MASK))
|
||||
tagmask = tagmask | c->tags;
|
||||
#else
|
||||
tagmask = tagmask | c->tags;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
}
|
||||
#if TAGSYNC_PATCH
|
||||
selmon = origselmon;
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
|
||||
#else
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
|
||||
do {
|
||||
if (arg->i > 0) // left circular shift
|
||||
shifted.ui = (shifted.ui << arg->i)
|
||||
| (shifted.ui >> (NUMTAGS - arg->i));
|
||||
else // right circular shift
|
||||
shifted.ui = (shifted.ui >> -arg->i)
|
||||
| (shifted.ui << (NUMTAGS + arg->i));
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
shifted.ui &= ~SPTAGMASK;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
|
||||
tag(&shifted);
|
||||
}
|
1
patch/shifttagclients.h
Normal file
1
patch/shifttagclients.h
Normal file
@ -0,0 +1 @@
|
||||
static void shifttagclients(const Arg *arg);
|
@ -10,6 +10,8 @@ shiftviewclients(const Arg *arg)
|
||||
for (selmon = mons; selmon; selmon = selmon->next)
|
||||
#endif // TAGSYNC_PATCH
|
||||
for (c = selmon->clients; c; c = c->next) {
|
||||
if (c == selmon->sel)
|
||||
continue;
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
if (!(c->tags & SPTAGMASK))
|
||||
tagmask = tagmask | c->tags;
|
||||
@ -44,4 +46,3 @@ shiftviewclients(const Arg *arg)
|
||||
|
||||
view(&shifted);
|
||||
}
|
||||
|
||||
|
@ -974,6 +974,12 @@
|
||||
*/
|
||||
#define SHIFTTAG_PATCH 0
|
||||
|
||||
/* Moves the current selected client to the adjacent tag that has at least one client, if none
|
||||
* then it acts as shifttag.
|
||||
* https://dwm.suckless.org/patches/shift-tools/
|
||||
*/
|
||||
#define SHIFTTAGCLIENTS_PATCH 0
|
||||
|
||||
/* This patch adds keybindings for left and right circular shift through tags.
|
||||
* https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user