Adding shiftswaptags patch ref. #270

This commit is contained in:
bakkeby 2022-07-04 13:56:39 +02:00
parent d3ab291944
commit 197c218304
7 changed files with 50 additions and 2 deletions

View File

@ -999,6 +999,10 @@ static Key keys[] = {
{ MODKEY|ControlMask, XK_Left, shiftboth, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoleft { MODKEY|ControlMask, XK_Left, shiftboth, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoleft
{ MODKEY|ControlMask, XK_Right, shiftboth, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoright { MODKEY|ControlMask, XK_Right, shiftboth, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoright
#endif // SHIFTBOTH_PATCH #endif // SHIFTBOTH_PATCH
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
{ MODKEY|Mod4Mask|ShiftMask, XK_Left, shiftswaptags, { .i = -1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Right, shiftswaptags, { .i = +1 } },
#endif // SHIFTSWAPTAGS_PATCH
#if BAR_WINTITLEACTIONS_PATCH #if BAR_WINTITLEACTIONS_PATCH
{ MODKEY|ControlMask, XK_z, showhideclient, {0} }, { MODKEY|ControlMask, XK_z, showhideclient, {0} },
#endif // BAR_WINTITLEACTIONS_PATCH #endif // BAR_WINTITLEACTIONS_PATCH
@ -1433,6 +1437,9 @@ static Signal signals[] = {
{ "viewall", viewallex }, { "viewall", viewallex },
{ "viewex", viewex }, { "viewex", viewex },
{ "toggleview", toggleview }, { "toggleview", toggleview },
#if SHIFTBOTH_PATCH
{ "shiftboth", shiftboth },
#endif // SHIFTBOTH_PATCH
#if SHIFTTAG_PATCH #if SHIFTTAG_PATCH
{ "shifttag", shifttag }, { "shifttag", shifttag },
#endif // SHIFTTAG_PATCH #endif // SHIFTTAG_PATCH
@ -1445,6 +1452,9 @@ static Signal signals[] = {
#if SHIFTVIEW_CLIENTS_PATCH #if SHIFTVIEW_CLIENTS_PATCH
{ "shiftviewclients", shiftviewclients }, { "shiftviewclients", shiftviewclients },
#endif // SHIFTVIEW_CLIENTS_PATCH #endif // SHIFTVIEW_CLIENTS_PATCH
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
{ "shiftswaptags", shiftswaptags },
#endif // SHIFTSWAPTAGS_PATCH
#if SELFRESTART_PATCH #if SELFRESTART_PATCH
{ "self_restart", self_restart }, { "self_restart", self_restart },
#endif // SELFRESTART_PATCH #endif // SELFRESTART_PATCH
@ -1627,9 +1637,12 @@ static IPCCommand ipccommands[] = {
#if SETBORDERPX_PATCH #if SETBORDERPX_PATCH
IPCCOMMAND( setborderpx, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( setborderpx, 1, {ARG_TYPE_SINT} ),
#endif // SETBORDERPX_PATCH #endif // SETBORDERPX_PATCH
#if SHIFTBOTH_PATCH
IPCCOMMAND( shiftboth, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTBOTH_PATCH
#if SHIFTTAG_PATCH #if SHIFTTAG_PATCH
IPCCOMMAND( shifttag, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( shifttag, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTVIEW_PATCH #endif // SHIFTTAG_PATCH
#if SHIFTTAGCLIENTS_PATCH #if SHIFTTAGCLIENTS_PATCH
IPCCOMMAND( shifttagclients, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( shifttagclients, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTVIEWCLIENTS_PATCH #endif // SHIFTVIEWCLIENTS_PATCH
@ -1639,6 +1652,9 @@ static IPCCommand ipccommands[] = {
#if SHIFTVIEW_CLIENTS_PATCH #if SHIFTVIEW_CLIENTS_PATCH
IPCCOMMAND( shiftviewclients, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( shiftviewclients, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTVIEW_CLIENTS_PATCH #endif // SHIFTVIEW_CLIENTS_PATCH
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
IPCCOMMAND( shiftswaptags, 1, {ARG_TYPE_SINT} ),
#endif // SHIFTSWAPTAGS_PATCH
#if STACKER_PATCH #if STACKER_PATCH
IPCCOMMAND( pushstack, 1, {ARG_TYPE_SINT} ), IPCCOMMAND( pushstack, 1, {ARG_TYPE_SINT} ),
#endif // STACKER_PATCH #endif // STACKER_PATCH

View File

@ -235,6 +235,9 @@
#if SHIFTBOTH_PATCH #if SHIFTBOTH_PATCH
#include "shiftboth.c" #include "shiftboth.c"
#endif #endif
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
#include "shiftswaptags.c"
#endif
#if SHIFTTAG_PATCH #if SHIFTTAG_PATCH
#include "shifttag.c" #include "shifttag.c"
#endif #endif

View File

@ -237,6 +237,9 @@
#if SHIFTBOTH_PATCH #if SHIFTBOTH_PATCH
#include "shiftboth.h" #include "shiftboth.h"
#endif #endif
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
#include "shiftswaptags.h"
#endif
#if SHIFTTAG_PATCH #if SHIFTTAG_PATCH
#include "shifttag.h" #include "shifttag.h"
#endif #endif

20
patch/shiftswaptags.c Normal file
View File

@ -0,0 +1,20 @@
/* swaps "tags" (all the clients) with the next/prev tag. */
void
shiftswaptags(const Arg *arg)
{
Arg shifted;
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
shifted.ui = selmon->tagset[selmon->seltags];
#else
shifted.ui = selmon->tagset[selmon->seltags];
#endif // SCRATCHPADS_PATCH
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
swaptags(&shifted);
}

1
patch/shiftswaptags.h Normal file
View File

@ -0,0 +1 @@
static void shiftswaptags(const Arg *arg);

View File

@ -28,4 +28,3 @@ swaptags(const Arg *arg)
view(&((Arg) { .ui = newtag })); view(&((Arg) { .ui = newtag }));
} }

View File

@ -974,6 +974,12 @@
*/ */
#define SHIFTBOTH_PATCH 0 #define SHIFTBOTH_PATCH 0
/* Swaps all the clients on the current tag with all the client on the next/prev tag.
* Depends on the swaptags patch.
* https://dwm.suckless.org/patches/shift-tools/
*/
#define SHIFTSWAPTAGS_PATCH 0
/* Moves the current selected client to the adjacent tag. /* Moves the current selected client to the adjacent tag.
* Also see the focusadjacenttag patch. * Also see the focusadjacenttag patch.
* https://dwm.suckless.org/patches/shift-tools/ * https://dwm.suckless.org/patches/shift-tools/