Adding shifttag patch ref. #270

This commit is contained in:
bakkeby
2022-07-04 11:25:28 +02:00
parent 404401622b
commit a15a259926
6 changed files with 45 additions and 3 deletions

View File

@@ -232,6 +232,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.c"
#endif
#if SHIFTTAG_PATCH
#include "shifttag.c"
#endif
#if SHIFTVIEW_PATCH
#include "shiftview.c"
#endif

View File

@@ -234,6 +234,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.h"
#endif
#if SHIFTTAG_PATCH
#include "shifttag.h"
#endif
#if SHIFTVIEW_PATCH
#include "shiftview.h"
#endif

20
patch/shifttag.c Normal file
View File

@@ -0,0 +1,20 @@
/* Sends a window to the next/prev tag */
void
shifttag(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
tag(&shifted);
}

1
patch/shifttag.h Normal file
View File

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