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

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

View File

@@ -237,6 +237,9 @@
#if SHIFTBOTH_PATCH
#include "shiftboth.h"
#endif
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
#include "shiftswaptags.h"
#endif
#if SHIFTTAG_PATCH
#include "shifttag.h"
#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 }));
}